<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2011

-}</span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-pragma">{-# LANGUAGE CPP, ScopedTypeVariables, TupleSections #-}</span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-9"></span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-11"></span><span>
</span><span id="line-12"></span><span class="hs-comment">-- | The deriving code for the Generic class</span><span>
</span><span id="line-13"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Tc.Deriv.Generics</span><span>
</span><span id="line-14"></span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#canDoGenerics"><span class="hs-identifier">canDoGenerics</span></a></span><span>
</span><span id="line-15"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#canDoGenerics1"><span class="hs-identifier">canDoGenerics1</span></a></span><span>
</span><span id="line-16"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind"><span class="hs-identifier">GenericKind</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-17"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#gen_Generic_binds"><span class="hs-identifier">gen_Generic_binds</span></a></span><span>
</span><span id="line-18"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#get_gen1_constrained_tys"><span class="hs-identifier">get_gen1_constrained_tys</span></a></span><span>
</span><span id="line-19"></span><span>   </span><span class="hs-special">)</span><span>
</span><span id="line-20"></span><span class="hs-keyword">where</span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-23"></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generate.html"><span class="hs-identifier">GHC.Tc.Deriv.Generate</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Functor.html"><span class="hs-identifier">GHC.Tc.Deriv.Functor</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html"><span class="hs-identifier">GHC.Core.FamInstEnv</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInst"><span class="hs-identifier">FamInst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamFlavor"><span class="hs-identifier">FamFlavor</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#mkSingleCoAxiom"><span class="hs-identifier">mkSingleCoAxiom</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Multiplicity.html"><span class="hs-identifier">GHC.Core.Multiplicity</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Family.html"><span class="hs-identifier">GHC.Tc.Instance.Family</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier">moduleName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#moduleNameFS"><span class="hs-identifier">moduleNameFS</span></a></span><span>
</span><span id="line-35"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#moduleUnit"><span class="hs-identifier">moduleUnit</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#unitFS"><span class="hs-identifier">unitFS</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html#getModule"><span class="hs-identifier">getModule</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Env.html"><span class="hs-identifier">GHC.Iface.Env</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Iface.Env.html#newGlobalBinder"><span class="hs-identifier">newGlobalBinder</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#varName"><span class="hs-identifier">varName</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html"><span class="hs-identifier">GHC.Types.Name.Reader</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.Prim.html"><span class="hs-identifier">GHC.Builtin.Types.Prim</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html"><span class="hs-identifier">GHC.Builtin.Types</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Env.html"><span class="hs-identifier">GHC.Tc.Utils.Env</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier">Validity</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#andValid"><span class="hs-identifier">andValid</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html"><span class="hs-identifier">GHC.Data.Bag</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html"><span class="hs-identifier">GHC.Types.Var.Env</span></a></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Set.html#elemVarSet"><span class="hs-identifier">elemVarSet</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-identifier">mplus</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.OldList.html#zip4"><span class="hs-identifier">zip4</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier">partition</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier">isJust</span></a></span><span class="hs-special">)</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-61"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Bindings for the new generic deriving mechanism}
*                                                                      *
************************************************************************

For the generic representation we need to generate:
\begin{itemize}
\item A Generic instance
\item A Rep type instance
\item Many auxiliary datatypes and instances for them (for the meta-information)
\end{itemize}
-}</span><span>
</span><span id="line-75"></span><span>
</span><span id="line-76"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#gen_Generic_binds"><span class="hs-identifier hs-type">gen_Generic_binds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind"><span class="hs-identifier hs-type">GenericKind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-77"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInst"><span class="hs-identifier hs-type">FamInst</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-78"></span><span id="gen_Generic_binds"><span class="annot"><span class="annottext">gen_Generic_binds :: GenericKind -&gt; TyCon -&gt; [Type] -&gt; TcM (LHsBinds GhcPs, FamInst)
</span><a href="GHC.Tc.Deriv.Generics.html#gen_Generic_binds"><span class="hs-identifier hs-var hs-var">gen_Generic_binds</span></a></span></span><span> </span><span id="local-6989586621681171138"><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681171138"><span class="hs-identifier hs-var">gk</span></a></span></span><span> </span><span id="local-6989586621681171137"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171137"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span id="local-6989586621681171136"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681171136"><span class="hs-identifier hs-var">inst_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-79"></span><span>  </span><span id="local-6989586621681171135"><span class="annot"><span class="annottext">FamInst
</span><a href="#local-6989586621681171135"><span class="hs-identifier hs-var">repTyInsts</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GenericKind -&gt; TyCon -&gt; [Type] -&gt; TcM FamInst
</span><a href="GHC.Tc.Deriv.Generics.html#tc_mkRepFamInsts"><span class="hs-identifier hs-var">tc_mkRepFamInsts</span></a></span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681171138"><span class="hs-identifier hs-var">gk</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171137"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681171136"><span class="hs-identifier hs-var">inst_tys</span></a></span><span>
</span><span id="line-80"></span><span>  </span><span class="annot"><span class="annottext">(LHsBinds GhcPs, FamInst) -&gt; TcM (LHsBinds GhcPs, FamInst)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenericKind -&gt; TyCon -&gt; LHsBinds GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkBindsRep"><span class="hs-identifier hs-var">mkBindsRep</span></a></span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681171138"><span class="hs-identifier hs-var">gk</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171137"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FamInst
</span><a href="#local-6989586621681171135"><span class="hs-identifier hs-var">repTyInsts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Generating representation types}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-89"></span><span>
</span><span id="line-90"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#get_gen1_constrained_tys"><span class="hs-identifier hs-type">get_gen1_constrained_tys</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-91"></span><span class="hs-comment">-- called by GHC.Tc.Deriv.Infer.inferConstraints; generates a list of</span><span>
</span><span id="line-92"></span><span class="hs-comment">-- types, each of which must be a Functor in order for the Generic1 instance to</span><span>
</span><span id="line-93"></span><span class="hs-comment">-- work.</span><span>
</span><span id="line-94"></span><span id="get_gen1_constrained_tys"><span class="annot"><span class="annottext">get_gen1_constrained_tys :: TyVar -&gt; Type -&gt; [Type]
</span><a href="GHC.Tc.Deriv.Generics.html#get_gen1_constrained_tys"><span class="hs-identifier hs-var hs-var">get_gen1_constrained_tys</span></a></span></span><span> </span><span id="local-6989586621681171132"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681171132"><span class="hs-identifier hs-var">argVar</span></a></span></span><span>
</span><span id="line-95"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; ArgTyAlg [Type] -&gt; Type -&gt; [Type]
forall a. TyVar -&gt; ArgTyAlg a -&gt; Type -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#argTyFold"><span class="hs-identifier hs-var">argTyFold</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681171132"><span class="hs-identifier hs-var">argVar</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgTyAlg [Type] -&gt; Type -&gt; [Type])
-&gt; ArgTyAlg [Type] -&gt; Type -&gt; [Type]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ArgTyAlg :: forall a.
(Type -&gt; a) -&gt; a -&gt; (Type -&gt; a) -&gt; (Type -&gt; a -&gt; a) -&gt; ArgTyAlg a
</span><a href="GHC.Tc.Deriv.Generics.html#ArgTyAlg"><span class="hs-identifier hs-type">ArgTyAlg</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ata_rec0 :: Type -&gt; [Type]
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec0"><span class="hs-identifier hs-var">ata_rec0</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; Type -&gt; [Type]
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-96"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ata_par1 :: [Type]
</span><a href="GHC.Tc.Deriv.Generics.html#ata_par1"><span class="hs-identifier hs-var">ata_par1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ata_rec1 :: Type -&gt; [Type]
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec1"><span class="hs-identifier hs-var">ata_rec1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; Type -&gt; [Type]
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-97"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ata_comp :: Type -&gt; [Type] -&gt; [Type]
</span><a href="GHC.Tc.Deriv.Generics.html#ata_comp"><span class="hs-identifier hs-var">ata_comp</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="hs-comment">{-

Note [Requirements for deriving Generic and Rep]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In the following, T, Tfun, and Targ are &quot;meta-variables&quot; ranging over type
expressions.

(Generic T) and (Rep T) are derivable for some type expression T if the
following constraints are satisfied.

  (a) D is a type constructor *value*. In other words, D is either a type
      constructor or it is equivalent to the head of a data family instance (up to
      alpha-renaming).

  (b) D cannot have a &quot;stupid context&quot;.

  (c) The right-hand side of D cannot include existential types, universally
      quantified types, or &quot;exotic&quot; unlifted types. An exotic unlifted type
      is one which is not listed in the definition of allowedUnliftedTy
      (i.e., one for which we have no representation type).
      See Note [Generics and unlifted types]

  (d) T :: *.

(Generic1 T) and (Rep1 T) are derivable for some type expression T if the
following constraints are satisfied.

  (a),(b),(c) As above.

  (d) T must expect arguments, and its last parameter must have kind *.

      We use `a' to denote the parameter of D that corresponds to the last
      parameter of T.

  (e) For any type-level application (Tfun Targ) in the right-hand side of D
      where the head of Tfun is not a tuple constructor:

      (b1) `a' must not occur in Tfun.

      (b2) If `a' occurs in Targ, then Tfun :: * -&gt; *.

-}</span><span>
</span><span id="line-142"></span><span>
</span><span id="line-143"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#canDoGenerics"><span class="hs-identifier hs-type">canDoGenerics</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-144"></span><span class="hs-comment">-- canDoGenerics determines if Generic/Rep can be derived.</span><span>
</span><span id="line-145"></span><span class="hs-comment">--</span><span>
</span><span id="line-146"></span><span class="hs-comment">-- Check (a) from Note [Requirements for deriving Generic and Rep] is taken</span><span>
</span><span id="line-147"></span><span class="hs-comment">-- care of because canDoGenerics is applied to rep tycons.</span><span>
</span><span id="line-148"></span><span class="hs-comment">--</span><span>
</span><span id="line-149"></span><span class="hs-comment">-- It returns IsValid if deriving is possible. It returns (NotValid reason)</span><span>
</span><span id="line-150"></span><span class="hs-comment">-- if not.</span><span>
</span><span id="line-151"></span><span id="canDoGenerics"><span class="annot"><span class="annottext">canDoGenerics :: TyCon -&gt; Validity
</span><a href="GHC.Tc.Deriv.Generics.html#canDoGenerics"><span class="hs-identifier hs-var hs-var">canDoGenerics</span></a></span></span><span> </span><span id="local-6989586621681171124"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171124"><span class="hs-identifier hs-var">tc</span></a></span></span><span>
</span><span id="line-152"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Validity] -&gt; Validity
</span><a href="GHC.Tc.Deriv.Generics.html#mergeErrors"><span class="hs-identifier hs-var">mergeErrors</span></a></span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-153"></span><span>          </span><span class="hs-comment">-- Check (b) from Note [Requirements for deriving Generic and Rep].</span><span>
</span><span id="line-154"></span><span>              </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Type]
</span><a href="GHC.Core.TyCon.html#tyConStupidTheta"><span class="hs-identifier hs-var">tyConStupidTheta</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171124"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-155"></span><span>                </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MsgDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171118"><span class="hs-identifier hs-var">tc_name</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;must not have a datatype context&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-156"></span><span>                </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-157"></span><span>          </span><span class="hs-comment">-- See comment below</span><span>
</span><span id="line-158"></span><span>            </span><span class="annot"><span class="annottext">Validity -&gt; [Validity] -&gt; [Validity]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(DataCon -&gt; Validity) -&gt; [DataCon] -&gt; [Validity]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Validity
</span><a href="#local-6989586621681171114"><span class="hs-identifier hs-var">bad_con</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [DataCon]
</span><a href="GHC.Core.TyCon.html#tyConDataCons"><span class="hs-identifier hs-var">tyConDataCons</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171124"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-159"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-160"></span><span>    </span><span class="hs-comment">-- The tc can be a representation tycon. When we want to display it to the</span><span>
</span><span id="line-161"></span><span>    </span><span class="hs-comment">-- user (in an error message) we should print its parent</span><span>
</span><span id="line-162"></span><span>    </span><span id="local-6989586621681171118"><span class="annot"><span class="annottext">tc_name :: MsgDoc
</span><a href="#local-6989586621681171118"><span class="hs-identifier hs-var hs-var">tc_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; MsgDoc) -&gt; TyCon -&gt; MsgDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.TyCon.html#tyConFamInst_maybe"><span class="hs-identifier hs-var">tyConFamInst_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171124"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-163"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681171110"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171110"><span class="hs-identifier hs-var">ptc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171110"><span class="hs-identifier hs-var">ptc</span></a></span><span>
</span><span id="line-164"></span><span>        </span><span class="annot"><span class="annottext">Maybe (TyCon, [Type])
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171124"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-165"></span><span>
</span><span id="line-166"></span><span>        </span><span class="hs-comment">-- Check (c) from Note [Requirements for deriving Generic and Rep].</span><span>
</span><span id="line-167"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-168"></span><span>        </span><span class="hs-comment">-- If any of the constructors has an exotic unlifted type as argument,</span><span>
</span><span id="line-169"></span><span>        </span><span class="hs-comment">-- then we can't build the embedding-projection pair, because</span><span>
</span><span id="line-170"></span><span>        </span><span class="hs-comment">-- it relies on instantiating *polymorphic* sum and product types</span><span>
</span><span id="line-171"></span><span>        </span><span class="hs-comment">-- at the argument types of the constructors</span><span>
</span><span id="line-172"></span><span>    </span><span id="local-6989586621681171114"><span class="annot"><span class="annottext">bad_con :: DataCon -&gt; Validity
</span><a href="#local-6989586621681171114"><span class="hs-identifier hs-var hs-var">bad_con</span></a></span></span><span> </span><span id="local-6989586621681171106"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171106"><span class="hs-identifier hs-var">dc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Type -&gt; Bool) -&gt; [Type] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="#local-6989586621681171104"><span class="hs-identifier hs-var">bad_arg_type</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Scaled Type -&gt; Type) -&gt; [Scaled Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">([Scaled Type] -&gt; [Type]) -&gt; [Scaled Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Scaled Type]
</span><a href="GHC.Core.DataCon.html#dataConOrigArgTys"><span class="hs-identifier hs-var">dataConOrigArgTys</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171106"><span class="hs-identifier hs-var">dc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-173"></span><span>                  </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MsgDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171106"><span class="hs-identifier hs-var">dc</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span>
</span><span id="line-174"></span><span>                    </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;must not have exotic unlifted or polymorphic arguments&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-175"></span><span>                  </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; Bool
</span><a href="GHC.Core.DataCon.html#isVanillaDataCon"><span class="hs-identifier hs-var">isVanillaDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171106"><span class="hs-identifier hs-var">dc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-176"></span><span>                          </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MsgDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171106"><span class="hs-identifier hs-var">dc</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;must be a vanilla data constructor&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-177"></span><span>                          </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-178"></span><span>
</span><span id="line-179"></span><span>        </span><span class="hs-comment">-- Nor can we do the job if it's an existential data constructor,</span><span>
</span><span id="line-180"></span><span>        </span><span class="hs-comment">-- Nor if the args are polymorphic types (I don't think)</span><span>
</span><span id="line-181"></span><span>    </span><span id="local-6989586621681171104"><span class="annot"><span class="annottext">bad_arg_type :: Type -&gt; Bool
</span><a href="#local-6989586621681171104"><span class="hs-identifier hs-var hs-var">bad_arg_type</span></a></span></span><span> </span><span id="local-6989586621681171099"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681171099"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Bool
Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isUnliftedType"><span class="hs-identifier hs-var">isUnliftedType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681171099"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Tc.Deriv.Generics.html#allowedUnliftedTy"><span class="hs-identifier hs-var">allowedUnliftedTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681171099"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-182"></span><span>                      </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isTauTy"><span class="hs-identifier hs-var">isTauTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681171099"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-183"></span><span>
</span><span id="line-184"></span><span class="hs-comment">-- Returns True the Type argument is an unlifted type which has a</span><span>
</span><span id="line-185"></span><span class="hs-comment">-- corresponding generic representation type. For example,</span><span>
</span><span id="line-186"></span><span class="hs-comment">-- (allowedUnliftedTy Int#) would return True since there is the UInt</span><span>
</span><span id="line-187"></span><span class="hs-comment">-- representation type.</span><span>
</span><span id="line-188"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#allowedUnliftedTy"><span class="hs-identifier hs-type">allowedUnliftedTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-189"></span><span id="allowedUnliftedTy"><span class="annot"><span class="annottext">allowedUnliftedTy :: Type -&gt; Bool
</span><a href="GHC.Tc.Deriv.Generics.html#allowedUnliftedTy"><span class="hs-identifier hs-var hs-var">allowedUnliftedTy</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (RdrName, RdrName) -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier hs-var">isJust</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (RdrName, RdrName) -&gt; Bool)
-&gt; (Type -&gt; Maybe (RdrName, RdrName)) -&gt; Type -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (RdrName, RdrName)
</span><a href="GHC.Tc.Deriv.Generics.html#unboxedRepRDRs"><span class="hs-identifier hs-var">unboxedRepRDRs</span></a></span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mergeErrors"><span class="hs-identifier hs-type">mergeErrors</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-192"></span><span id="mergeErrors"><span class="annot"><span class="annottext">mergeErrors :: [Validity] -&gt; Validity
</span><a href="GHC.Tc.Deriv.Generics.html#mergeErrors"><span class="hs-identifier hs-var hs-var">mergeErrors</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-193"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mergeErrors"><span class="hs-identifier hs-var">mergeErrors</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-type">NotValid</span></a></span><span> </span><span id="local-6989586621681171091"><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171091"><span class="hs-identifier hs-var">s</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681171090"><span class="annot"><span class="annottext">[Validity]
</span><a href="#local-6989586621681171090"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Validity] -&gt; Validity
</span><a href="GHC.Tc.Deriv.Generics.html#mergeErrors"><span class="hs-identifier hs-var">mergeErrors</span></a></span><span> </span><span class="annot"><span class="annottext">[Validity]
</span><a href="#local-6989586621681171090"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-194"></span><span>  </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171091"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-195"></span><span>  </span><span class="annot"><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-type">NotValid</span></a></span><span> </span><span id="local-6989586621681171089"><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171089"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171091"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;, and&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171089"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-196"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mergeErrors"><span class="hs-identifier hs-var">mergeErrors</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681171086"><span class="annot"><span class="annottext">[Validity]
</span><a href="#local-6989586621681171086"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Validity] -&gt; Validity
</span><a href="GHC.Tc.Deriv.Generics.html#mergeErrors"><span class="hs-identifier hs-var">mergeErrors</span></a></span><span> </span><span class="annot"><span class="annottext">[Validity]
</span><a href="#local-6989586621681171086"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-197"></span><span>
</span><span id="line-198"></span><span class="hs-comment">-- A datatype used only inside of canDoGenerics1. It's the result of analysing</span><span>
</span><span id="line-199"></span><span class="hs-comment">-- a type term.</span><span>
</span><span id="line-200"></span><span class="hs-keyword">data</span><span> </span><span id="Check_for_CanDoGenerics1"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Check_for_CanDoGenerics1"><span class="hs-identifier hs-var">Check_for_CanDoGenerics1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="CCDG1"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#CCDG1"><span class="hs-identifier hs-var">CCDG1</span></a></span></span><span>
</span><span id="line-201"></span><span>  </span><span class="hs-special">{</span><span> </span><span id="_ccdg1_hasParam"><span class="annot"><span class="annottext">Check_for_CanDoGenerics1 -&gt; Bool
</span><a href="GHC.Tc.Deriv.Generics.html#_ccdg1_hasParam"><span class="hs-identifier hs-var hs-var">_ccdg1_hasParam</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>       </span><span class="hs-comment">-- does the parameter of interest occurs in</span><span>
</span><span id="line-202"></span><span>                                  </span><span class="hs-comment">-- this type?</span><span>
</span><span id="line-203"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="_ccdg1_errors"><span class="annot"><span class="annottext">Check_for_CanDoGenerics1 -&gt; Validity
</span><a href="GHC.Tc.Deriv.Generics.html#_ccdg1_errors"><span class="hs-identifier hs-var hs-var">_ccdg1_errors</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>   </span><span class="hs-comment">-- errors generated by this type</span><span>
</span><span id="line-204"></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-205"></span><span>
</span><span id="line-206"></span><span class="hs-comment">{-

Note [degenerate use of FFoldType]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We use foldDataConArgs here only for its ability to treat tuples
specially. foldDataConArgs also tracks covariance (though it assumes all
higher-order type parameters are covariant) and has hooks for special handling
of functions and polytypes, but we do *not* use those.

The key issue is that Generic1 deriving currently offers no sophisticated
support for functions. For example, we cannot handle

  data F a = F ((a -&gt; Int) -&gt; Int)

even though a is occurring covariantly.

In fact, our rule is harsh: a is simply not allowed to occur within the first
argument of (-&gt;). We treat (-&gt;) the same as any other non-tuple tycon.

Unfortunately, this means we have to track &quot;the parameter occurs in this type&quot;
explicitly, even though foldDataConArgs is also doing this internally.

-}</span><span>
</span><span id="line-230"></span><span>
</span><span id="line-231"></span><span class="hs-comment">-- canDoGenerics1 determines if a Generic1/Rep1 can be derived.</span><span>
</span><span id="line-232"></span><span class="hs-comment">--</span><span>
</span><span id="line-233"></span><span class="hs-comment">-- Checks (a) through (c) from Note [Requirements for deriving Generic and Rep]</span><span>
</span><span id="line-234"></span><span class="hs-comment">-- are taken care of by the call to canDoGenerics.</span><span>
</span><span id="line-235"></span><span class="hs-comment">--</span><span>
</span><span id="line-236"></span><span class="hs-comment">-- It returns IsValid if deriving is possible. It returns (NotValid reason)</span><span>
</span><span id="line-237"></span><span class="hs-comment">-- if not.</span><span>
</span><span id="line-238"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#canDoGenerics1"><span class="hs-identifier hs-type">canDoGenerics1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-239"></span><span id="canDoGenerics1"><span class="annot"><span class="annottext">canDoGenerics1 :: TyCon -&gt; Validity
</span><a href="GHC.Tc.Deriv.Generics.html#canDoGenerics1"><span class="hs-identifier hs-var hs-var">canDoGenerics1</span></a></span></span><span> </span><span id="local-6989586621681171082"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171082"><span class="hs-identifier hs-var">rep_tc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-240"></span><span>  </span><span class="annot"><span class="annottext">TyCon -&gt; Validity
</span><a href="GHC.Tc.Deriv.Generics.html#canDoGenerics"><span class="hs-identifier hs-var">canDoGenerics</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171082"><span class="hs-identifier hs-var">rep_tc</span></a></span><span> </span><span class="annot"><span class="annottext">Validity -&gt; Validity -&gt; Validity
</span><a href="GHC.Utils.Error.html#andValid"><span class="hs-operator hs-var">`andValid`</span></a></span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="#local-6989586621681171081"><span class="hs-identifier hs-var">additionalChecks</span></a></span><span>
</span><span id="line-241"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-242"></span><span>    </span><span id="local-6989586621681171081"><span class="annot"><span class="annottext">additionalChecks :: Validity
</span><a href="#local-6989586621681171081"><span class="hs-identifier hs-var hs-var">additionalChecks</span></a></span></span><span>
</span><span id="line-243"></span><span>        </span><span class="hs-comment">-- check (d) from Note [Requirements for deriving Generic and Rep]</span><span>
</span><span id="line-244"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [TyVar]
</span><a href="GHC.Core.TyCon.html#tyConTyVars"><span class="hs-identifier hs-var hs-var">tyConTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171082"><span class="hs-identifier hs-var">rep_tc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; Validity) -&gt; MsgDoc -&gt; Validity
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-245"></span><span>          </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data type&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171082"><span class="hs-identifier hs-var">rep_tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-246"></span><span>      </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;must have some type parameters&quot;</span></span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Validity] -&gt; Validity
</span><a href="GHC.Tc.Deriv.Generics.html#mergeErrors"><span class="hs-identifier hs-var">mergeErrors</span></a></span><span> </span><span class="annot"><span class="annottext">([Validity] -&gt; Validity) -&gt; [Validity] -&gt; Validity
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(DataCon -&gt; [Validity]) -&gt; [DataCon] -&gt; [Validity]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Validity]
</span><a href="#local-6989586621681171077"><span class="hs-identifier hs-var">check_con</span></a></span><span> </span><span class="annot"><span class="annottext">[DataCon]
</span><a href="#local-6989586621681171076"><span class="hs-identifier hs-var">data_cons</span></a></span><span>
</span><span id="line-249"></span><span>
</span><span id="line-250"></span><span>    </span><span id="local-6989586621681171076"><span class="annot"><span class="annottext">data_cons :: [DataCon]
</span><a href="#local-6989586621681171076"><span class="hs-identifier hs-var hs-var">data_cons</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [DataCon]
</span><a href="GHC.Core.TyCon.html#tyConDataCons"><span class="hs-identifier hs-var">tyConDataCons</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171082"><span class="hs-identifier hs-var">rep_tc</span></a></span><span>
</span><span id="line-251"></span><span>    </span><span id="local-6989586621681171077"><span class="annot"><span class="annottext">check_con :: DataCon -&gt; [Validity]
</span><a href="#local-6989586621681171077"><span class="hs-identifier hs-var hs-var">check_con</span></a></span></span><span> </span><span id="local-6989586621681171075"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171075"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Validity
</span><a href="#local-6989586621681171074"><span class="hs-identifier hs-var">check_vanilla</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171075"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-252"></span><span>      </span><span id="local-6989586621681171073"><span class="annot"><span class="annottext">j :: Validity
</span><a href="#local-6989586621681171073"><span class="hs-identifier hs-var">j</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-type">NotValid</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Validity
</span><a href="#local-6989586621681171073"><span class="hs-identifier hs-var">j</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-253"></span><span>      </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1 -&gt; Validity
</span><a href="GHC.Tc.Deriv.Generics.html#_ccdg1_errors"><span class="hs-identifier hs-var hs-var">_ccdg1_errors</span></a></span><span> </span><span class="annot"><span class="annottext">(Check_for_CanDoGenerics1 -&gt; Validity)
-&gt; [Check_for_CanDoGenerics1] -&gt; [Validity]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-operator hs-var">`map`</span></a></span><span> </span><span class="annot"><span class="annottext">FFoldType Check_for_CanDoGenerics1
-&gt; DataCon -&gt; [Check_for_CanDoGenerics1]
forall a. FFoldType a -&gt; DataCon -&gt; [a]
</span><a href="GHC.Tc.Deriv.Functor.html#foldDataConArgs"><span class="hs-identifier hs-var">foldDataConArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; FFoldType Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171071"><span class="hs-identifier hs-var">ft_check</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171075"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171075"><span class="hs-identifier hs-var">con</span></a></span><span>
</span><span id="line-254"></span><span>
</span><span id="line-255"></span><span>    </span><span class="annot"><a href="#local-6989586621681171070"><span class="hs-identifier hs-type">bad</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-256"></span><span>    </span><span id="local-6989586621681171070"><span class="annot"><span class="annottext">bad :: DataCon -&gt; MsgDoc -&gt; MsgDoc
</span><a href="#local-6989586621681171070"><span class="hs-identifier hs-var hs-var">bad</span></a></span></span><span> </span><span id="local-6989586621681171068"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171068"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621681171067"><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171067"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Constructor&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171068"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171067"><span class="hs-identifier hs-var">msg</span></a></span><span>
</span><span id="line-257"></span><span>
</span><span id="line-258"></span><span>    </span><span class="annot"><a href="#local-6989586621681171074"><span class="hs-identifier hs-type">check_vanilla</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Validity"><span class="hs-identifier hs-type">Validity</span></a></span><span>
</span><span id="line-259"></span><span>    </span><span id="local-6989586621681171074"><span class="annot"><span class="annottext">check_vanilla :: DataCon -&gt; Validity
</span><a href="#local-6989586621681171074"><span class="hs-identifier hs-var hs-var">check_vanilla</span></a></span></span><span> </span><span id="local-6989586621681171066"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171066"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Bool
</span><a href="GHC.Core.DataCon.html#isVanillaDataCon"><span class="hs-identifier hs-var">isVanillaDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171066"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-260"></span><span>                      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; MsgDoc -&gt; MsgDoc
</span><a href="#local-6989586621681171070"><span class="hs-identifier hs-var">bad</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171066"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171065"><span class="hs-identifier hs-var">existential</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-261"></span><span>
</span><span id="line-262"></span><span>    </span><span id="local-6989586621681171064"><span class="annot"><span class="annottext">bmzero :: Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171064"><span class="hs-identifier hs-var hs-var">bmzero</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Validity -&gt; Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Generics.html#CCDG1"><span class="hs-identifier hs-var">CCDG1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-263"></span><span>    </span><span id="local-6989586621681171063"><span class="annot"><span class="annottext">bmbad :: DataCon -&gt; MsgDoc -&gt; Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171063"><span class="hs-identifier hs-var hs-var">bmbad</span></a></span></span><span> </span><span id="local-6989586621681171062"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171062"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621681171061"><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171061"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Validity -&gt; Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Generics.html#CCDG1"><span class="hs-identifier hs-var">CCDG1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">(Validity -&gt; Check_for_CanDoGenerics1)
-&gt; Validity -&gt; Check_for_CanDoGenerics1
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; Validity
</span><a href="GHC.Utils.Error.html#NotValid"><span class="hs-identifier hs-var">NotValid</span></a></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; Validity) -&gt; MsgDoc -&gt; Validity
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; MsgDoc -&gt; MsgDoc
</span><a href="#local-6989586621681171070"><span class="hs-identifier hs-var">bad</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171062"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171061"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-264"></span><span>    </span><span id="local-6989586621681171060"><span class="annot"><span class="annottext">bmplus :: Check_for_CanDoGenerics1
-&gt; Check_for_CanDoGenerics1 -&gt; Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171060"><span class="hs-identifier hs-var hs-var">bmplus</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#CCDG1"><span class="hs-identifier hs-type">CCDG1</span></a></span><span> </span><span id="local-6989586621681171059"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681171059"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621681171058"><span class="annot"><span class="annottext">Validity
</span><a href="#local-6989586621681171058"><span class="hs-identifier hs-var">m1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#CCDG1"><span class="hs-identifier hs-type">CCDG1</span></a></span><span> </span><span id="local-6989586621681171057"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681171057"><span class="hs-identifier hs-var">b2</span></a></span></span><span> </span><span id="local-6989586621681171056"><span class="annot"><span class="annottext">Validity
</span><a href="#local-6989586621681171056"><span class="hs-identifier hs-var">m2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Validity -&gt; Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Generics.html#CCDG1"><span class="hs-identifier hs-var">CCDG1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681171059"><span class="hs-identifier hs-var">b1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681171057"><span class="hs-identifier hs-var">b2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Validity
</span><a href="#local-6989586621681171058"><span class="hs-identifier hs-var">m1</span></a></span><span> </span><span class="annot"><span class="annottext">Validity -&gt; Validity -&gt; Validity
</span><a href="GHC.Utils.Error.html#andValid"><span class="hs-operator hs-var">`andValid`</span></a></span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="#local-6989586621681171056"><span class="hs-identifier hs-var">m2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-265"></span><span>
</span><span id="line-266"></span><span>    </span><span class="hs-comment">-- check (e) from Note [Requirements for deriving Generic and Rep]</span><span>
</span><span id="line-267"></span><span>    </span><span class="hs-comment">-- See also Note [degenerate use of FFoldType]</span><span>
</span><span id="line-268"></span><span>    </span><span class="annot"><a href="#local-6989586621681171071"><span class="hs-identifier hs-type">ft_check</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Functor.html#FFoldType"><span class="hs-identifier hs-type">FFoldType</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Check_for_CanDoGenerics1"><span class="hs-identifier hs-type">Check_for_CanDoGenerics1</span></a></span><span>
</span><span id="line-269"></span><span>    </span><span id="local-6989586621681171071"><span class="annot"><span class="annottext">ft_check :: DataCon -&gt; FFoldType Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171071"><span class="hs-identifier hs-var hs-var">ft_check</span></a></span></span><span> </span><span id="local-6989586621681171055"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171055"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FT :: forall a.
a
-&gt; a
-&gt; a
-&gt; (a -&gt; a -&gt; a)
-&gt; (TyCon -&gt; [a] -&gt; a)
-&gt; (Type -&gt; Type -&gt; a -&gt; a)
-&gt; a
-&gt; (TyVar -&gt; a -&gt; a)
-&gt; FFoldType a
</span><a href="GHC.Tc.Deriv.Functor.html#FT"><span class="hs-identifier hs-type">FT</span></a></span><span>
</span><span id="line-270"></span><span>      </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ft_triv :: Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Functor.html#ft_triv"><span class="hs-identifier hs-var">ft_triv</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171064"><span class="hs-identifier hs-var">bmzero</span></a></span><span>
</span><span id="line-271"></span><span>
</span><span id="line-272"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_var :: Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Functor.html#ft_var"><span class="hs-identifier hs-var">ft_var</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171051"><span class="hs-identifier hs-var">caseVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_co_var :: Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Functor.html#ft_co_var"><span class="hs-identifier hs-var">ft_co_var</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171051"><span class="hs-identifier hs-var">caseVar</span></a></span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span>      </span><span class="hs-comment">-- (component_0,component_1,...,component_n)</span><span>
</span><span id="line-275"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_tup :: TyCon -&gt; [Check_for_CanDoGenerics1] -&gt; Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Functor.html#ft_tup"><span class="hs-identifier hs-var">ft_tup</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">TyCon
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681171048"><span class="annot"><span class="annottext">[Check_for_CanDoGenerics1]
</span><a href="#local-6989586621681171048"><span class="hs-identifier hs-var">components</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">(Check_for_CanDoGenerics1 -&gt; Bool)
-&gt; [Check_for_CanDoGenerics1] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1 -&gt; Bool
</span><a href="GHC.Tc.Deriv.Generics.html#_ccdg1_hasParam"><span class="hs-identifier hs-var hs-var">_ccdg1_hasParam</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Check_for_CanDoGenerics1] -&gt; [Check_for_CanDoGenerics1]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#init"><span class="hs-identifier hs-var">init</span></a></span><span> </span><span class="annot"><span class="annottext">[Check_for_CanDoGenerics1]
</span><a href="#local-6989586621681171048"><span class="hs-identifier hs-var">components</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-276"></span><span>                                  </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; MsgDoc -&gt; Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171063"><span class="hs-identifier hs-var">bmbad</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171055"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171046"><span class="hs-identifier hs-var">wrong_arg</span></a></span><span>
</span><span id="line-277"></span><span>                                  </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">(Check_for_CanDoGenerics1
 -&gt; Check_for_CanDoGenerics1 -&gt; Check_for_CanDoGenerics1)
-&gt; Check_for_CanDoGenerics1
-&gt; [Check_for_CanDoGenerics1]
-&gt; Check_for_CanDoGenerics1
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
-&gt; Check_for_CanDoGenerics1 -&gt; Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171060"><span class="hs-identifier hs-var">bmplus</span></a></span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171064"><span class="hs-identifier hs-var">bmzero</span></a></span><span> </span><span class="annot"><span class="annottext">[Check_for_CanDoGenerics1]
</span><a href="#local-6989586621681171048"><span class="hs-identifier hs-var">components</span></a></span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span>      </span><span class="hs-comment">-- (dom -&gt; rng), where the head of ty is not a tuple tycon</span><span>
</span><span id="line-280"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_fun :: Check_for_CanDoGenerics1
-&gt; Check_for_CanDoGenerics1 -&gt; Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Functor.html#ft_fun"><span class="hs-identifier hs-var">ft_fun</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681171043"><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171043"><span class="hs-identifier hs-var">dom</span></a></span></span><span> </span><span id="local-6989586621681171042"><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171042"><span class="hs-identifier hs-var">rng</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-comment">-- cf #8516</span><span>
</span><span id="line-281"></span><span>          </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1 -&gt; Bool
</span><a href="GHC.Tc.Deriv.Generics.html#_ccdg1_hasParam"><span class="hs-identifier hs-var hs-var">_ccdg1_hasParam</span></a></span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171043"><span class="hs-identifier hs-var">dom</span></a></span><span>
</span><span id="line-282"></span><span>          </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; MsgDoc -&gt; Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171063"><span class="hs-identifier hs-var">bmbad</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171055"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171046"><span class="hs-identifier hs-var">wrong_arg</span></a></span><span>
</span><span id="line-283"></span><span>          </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
-&gt; Check_for_CanDoGenerics1 -&gt; Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171060"><span class="hs-identifier hs-var">bmplus</span></a></span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171043"><span class="hs-identifier hs-var">dom</span></a></span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171042"><span class="hs-identifier hs-var">rng</span></a></span><span>
</span><span id="line-284"></span><span>
</span><span id="line-285"></span><span>      </span><span class="hs-comment">-- (ty arg), where head of ty is neither (-&gt;) nor a tuple constructor and</span><span>
</span><span id="line-286"></span><span>      </span><span class="hs-comment">-- the parameter of interest does not occur in ty</span><span>
</span><span id="line-287"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_ty_app :: Type
-&gt; Type -&gt; Check_for_CanDoGenerics1 -&gt; Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Functor.html#ft_ty_app"><span class="hs-identifier hs-var">ft_ty_app</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681171040"><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171040"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171040"><span class="hs-identifier hs-var">arg</span></a></span><span>
</span><span id="line-288"></span><span>
</span><span id="line-289"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_bad_app :: Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Functor.html#ft_bad_app"><span class="hs-identifier hs-var">ft_bad_app</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; MsgDoc -&gt; Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171063"><span class="hs-identifier hs-var">bmbad</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171055"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621681171046"><span class="hs-identifier hs-var">wrong_arg</span></a></span><span>
</span><span id="line-290"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ft_forall :: TyVar -&gt; Check_for_CanDoGenerics1 -&gt; Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Functor.html#ft_forall"><span class="hs-identifier hs-var">ft_forall</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">TyVar
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681171037"><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171037"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171037"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="hs-comment">-- polytypes are handled elsewhere</span><span>
</span><span id="line-291"></span><span>      </span><span class="hs-special">}</span><span>
</span><span id="line-292"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-293"></span><span>        </span><span id="local-6989586621681171051"><span class="annot"><span class="annottext">caseVar :: Check_for_CanDoGenerics1
</span><a href="#local-6989586621681171051"><span class="hs-identifier hs-var hs-var">caseVar</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Validity -&gt; Check_for_CanDoGenerics1
</span><a href="GHC.Tc.Deriv.Generics.html#CCDG1"><span class="hs-identifier hs-var">CCDG1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Validity
</span><a href="GHC.Utils.Error.html#IsValid"><span class="hs-identifier hs-var">IsValid</span></a></span><span>
</span><span id="line-294"></span><span>
</span><span id="line-295"></span><span>
</span><span id="line-296"></span><span>    </span><span id="local-6989586621681171065"><span class="annot"><span class="annottext">existential :: MsgDoc
</span><a href="#local-6989586621681171065"><span class="hs-identifier hs-var hs-var">existential</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;must not have existential arguments&quot;</span></span><span>
</span><span id="line-297"></span><span>    </span><span id="local-6989586621681171046"><span class="annot"><span class="annottext">wrong_arg :: MsgDoc
</span><a href="#local-6989586621681171046"><span class="hs-identifier hs-var hs-var">wrong_arg</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;applies a type to an argument involving the last parameter&quot;</span></span><span>
</span><span id="line-298"></span><span>               </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;but the applied type is not of kind * -&gt; *&quot;</span></span><span>
</span><span id="line-299"></span><span>
</span><span id="line-300"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Generating the RHS of a generic default method}
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-307"></span><span>
</span><span id="line-308"></span><span class="hs-keyword">type</span><span> </span><span id="US"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#US"><span class="hs-identifier hs-var">US</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>   </span><span class="hs-comment">-- Local unique supply, just a plain Int</span><span>
</span><span id="line-309"></span><span class="hs-keyword">type</span><span> </span><span id="Alt"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Alt"><span class="hs-identifier hs-var">Alt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-310"></span><span>
</span><span id="line-311"></span><span class="hs-comment">-- GenericKind serves to mark if a datatype derives Generic (Gen0) or</span><span>
</span><span id="line-312"></span><span class="hs-comment">-- Generic1 (Gen1).</span><span>
</span><span id="line-313"></span><span class="hs-keyword">data</span><span> </span><span id="GenericKind"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind"><span class="hs-identifier hs-var">GenericKind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Gen0"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen0"><span class="hs-identifier hs-var">Gen0</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="Gen1"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen1"><span class="hs-identifier hs-var">Gen1</span></a></span></span><span>
</span><span id="line-314"></span><span>
</span><span id="line-315"></span><span class="hs-comment">-- as above, but with a payload of the TyCon's name for &quot;the&quot; parameter</span><span>
</span><span id="line-316"></span><span class="hs-keyword">data</span><span> </span><span id="GenericKind_"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind_"><span class="hs-identifier hs-var">GenericKind_</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Gen0_"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen0_"><span class="hs-identifier hs-var">Gen0_</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="Gen1_"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen1_"><span class="hs-identifier hs-var">Gen1_</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span>
</span><span id="line-317"></span><span>
</span><span id="line-318"></span><span class="hs-comment">-- as above, but using a single datacon's name for &quot;the&quot; parameter</span><span>
</span><span id="line-319"></span><span class="hs-keyword">data</span><span> </span><span id="GenericKind_DC"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind_DC"><span class="hs-identifier hs-var">GenericKind_DC</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Gen0_DC"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen0_DC"><span class="hs-identifier hs-var">Gen0_DC</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="Gen1_DC"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen1_DC"><span class="hs-identifier hs-var">Gen1_DC</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span>
</span><span id="line-320"></span><span>
</span><span id="line-321"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#forgetArgVar"><span class="hs-identifier hs-type">forgetArgVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind_DC"><span class="hs-identifier hs-type">GenericKind_DC</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind"><span class="hs-identifier hs-type">GenericKind</span></a></span><span>
</span><span id="line-322"></span><span id="forgetArgVar"><span class="annot"><span class="annottext">forgetArgVar :: GenericKind_DC -&gt; GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#forgetArgVar"><span class="hs-identifier hs-var hs-var">forgetArgVar</span></a></span></span><span> </span><span class="annot"><span class="annottext">GenericKind_DC
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0_DC"><span class="hs-identifier hs-var">Gen0_DC</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0"><span class="hs-identifier hs-var">Gen0</span></a></span><span>
</span><span id="line-323"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#forgetArgVar"><span class="hs-identifier hs-var">forgetArgVar</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen1_DC"><span class="hs-identifier hs-type">Gen1_DC</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen1"><span class="hs-identifier hs-var">Gen1</span></a></span><span>
</span><span id="line-324"></span><span>
</span><span id="line-325"></span><span class="hs-comment">-- When working only within a single datacon, &quot;the&quot; parameter's name should</span><span>
</span><span id="line-326"></span><span class="hs-comment">-- match that datacon's name for it.</span><span>
</span><span id="line-327"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#gk2gkDC"><span class="hs-identifier hs-type">gk2gkDC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind_"><span class="hs-identifier hs-type">GenericKind_</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind_DC"><span class="hs-identifier hs-type">GenericKind_DC</span></a></span><span>
</span><span id="line-328"></span><span id="gk2gkDC"><span class="annot"><span class="annottext">gk2gkDC :: GenericKind_ -&gt; DataCon -&gt; GenericKind_DC
</span><a href="GHC.Tc.Deriv.Generics.html#gk2gkDC"><span class="hs-identifier hs-var hs-var">gk2gkDC</span></a></span></span><span> </span><span class="annot"><span class="annottext">GenericKind_
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0_"><span class="hs-identifier hs-var">Gen0_</span></a></span><span>   </span><span class="annot"><span class="annottext">DataCon
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenericKind_DC
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0_DC"><span class="hs-identifier hs-var">Gen0_DC</span></a></span><span>
</span><span id="line-329"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#gk2gkDC"><span class="hs-identifier hs-var">gk2gkDC</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen1_"><span class="hs-identifier hs-type">Gen1_</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span id="local-6989586621681171028"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171028"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; GenericKind_DC
</span><a href="GHC.Tc.Deriv.Generics.html#Gen1_DC"><span class="hs-identifier hs-var">Gen1_DC</span></a></span><span> </span><span class="annot"><span class="annottext">(TyVar -&gt; GenericKind_DC) -&gt; TyVar -&gt; GenericKind_DC
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; TyVar
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#last"><span class="hs-identifier hs-var">last</span></a></span><span> </span><span class="annot"><span class="annottext">([TyVar] -&gt; TyVar) -&gt; [TyVar] -&gt; TyVar
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [TyVar]
</span><a href="GHC.Core.DataCon.html#dataConUnivTyVars"><span class="hs-identifier hs-var">dataConUnivTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681171028"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-330"></span><span>
</span><span id="line-331"></span><span>
</span><span id="line-332"></span><span class="hs-comment">-- Bindings for the Generic instance</span><span>
</span><span id="line-333"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mkBindsRep"><span class="hs-identifier hs-type">mkBindsRep</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind"><span class="hs-identifier hs-type">GenericKind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-334"></span><span id="mkBindsRep"><span class="annot"><span class="annottext">mkBindsRep :: GenericKind -&gt; TyCon -&gt; LHsBinds GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkBindsRep"><span class="hs-identifier hs-var hs-var">mkBindsRep</span></a></span></span><span> </span><span id="local-6989586621681171025"><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681171025"><span class="hs-identifier hs-var">gk</span></a></span></span><span> </span><span id="local-6989586621681171024"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171024"><span class="hs-identifier hs-var">tycon</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-335"></span><span>    </span><span class="annot"><span class="annottext">LHsBind GhcPs -&gt; LHsBinds GhcPs
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located RdrName -&gt; [LMatch GhcPs (LHsExpr GhcPs)] -&gt; LHsBind GhcPs
</span><a href="GHC.Tc.Deriv.Generate.html#mkRdrFunBind"><span class="hs-identifier hs-var">mkRdrFunBind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; RdrName -&gt; Located RdrName
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681171020"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681171019"><span class="hs-identifier hs-var">from01_RDR</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LMatch GhcPs (LHsExpr GhcPs)
</span><a href="#local-6989586621681171018"><span class="hs-identifier hs-var">from_eqn</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-336"></span><span>  </span><span class="annot"><span class="annottext">LHsBinds GhcPs -&gt; LHsBinds GhcPs -&gt; LHsBinds GhcPs
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span>
</span><span id="line-337"></span><span>    </span><span class="annot"><span class="annottext">LHsBind GhcPs -&gt; LHsBinds GhcPs
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located RdrName -&gt; [LMatch GhcPs (LHsExpr GhcPs)] -&gt; LHsBind GhcPs
</span><a href="GHC.Tc.Deriv.Generate.html#mkRdrFunBind"><span class="hs-identifier hs-var">mkRdrFunBind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; RdrName -&gt; Located RdrName
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681171020"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681171016"><span class="hs-identifier hs-var">to01_RDR</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LMatch GhcPs (LHsExpr GhcPs)
</span><a href="#local-6989586621681171015"><span class="hs-identifier hs-var">to_eqn</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-338"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-339"></span><span>        </span><span class="hs-comment">-- The topmost M1 (the datatype metadata) has the exact same type</span><span>
</span><span id="line-340"></span><span>        </span><span class="hs-comment">-- across all cases of a from/to definition, and can be factored out</span><span>
</span><span id="line-341"></span><span>        </span><span class="hs-comment">-- to save some allocations during typechecking.</span><span>
</span><span id="line-342"></span><span>        </span><span class="hs-comment">-- See Note [Generics compilation speed tricks]</span><span>
</span><span id="line-343"></span><span>        </span><span id="local-6989586621681171018"><span class="annot"><span class="annottext">from_eqn :: LMatch GhcPs (LHsExpr GhcPs)
</span><a href="#local-6989586621681171018"><span class="hs-identifier hs-var hs-var">from_eqn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LHsExpr GhcPs -&gt; LMatch GhcPs (LHsExpr GhcPs)
forall (p :: Pass) (body :: * -&gt; *).
LPat (GhcPass p)
-&gt; Located (body (GhcPass p))
-&gt; LMatch (GhcPass p) (Located (body (GhcPass p)))
</span><a href="GHC.Hs.Utils.html#mkHsCaseAlt"><span class="hs-identifier hs-var">mkHsCaseAlt</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_Pat"><span class="hs-identifier hs-var">x_Pat</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr GhcPs -&gt; LMatch GhcPs (LHsExpr GhcPs))
-&gt; LHsExpr GhcPs -&gt; LMatch GhcPs (LHsExpr GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkM1_E"><span class="hs-identifier hs-var">mkM1_E</span></a></span><span>
</span><span id="line-344"></span><span>                                       </span><span class="annot"><span class="annottext">(LHsExpr GhcPs -&gt; LHsExpr GhcPs) -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsPar"><span class="hs-identifier hs-var">nlHsPar</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr GhcPs -&gt; LHsExpr GhcPs) -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; [LMatch GhcPs (LHsExpr GhcPs)] -&gt; LHsExpr GhcPs
</span><a href="GHC.Hs.Utils.html#nlHsCase"><span class="hs-identifier hs-var">nlHsCase</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_Expr"><span class="hs-identifier hs-var">x_Expr</span></a></span><span> </span><span class="annot"><span class="annottext">[LMatch GhcPs (LHsExpr GhcPs)]
</span><a href="#local-6989586621681171008"><span class="hs-identifier hs-var">from_matches</span></a></span><span>
</span><span id="line-345"></span><span>        </span><span id="local-6989586621681171015"><span class="annot"><span class="annottext">to_eqn :: LMatch GhcPs (LHsExpr GhcPs)
</span><a href="#local-6989586621681171015"><span class="hs-identifier hs-var hs-var">to_eqn</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LHsExpr GhcPs -&gt; LMatch GhcPs (LHsExpr GhcPs)
forall (p :: Pass) (body :: * -&gt; *).
LPat (GhcPass p)
-&gt; Located (body (GhcPass p))
-&gt; LMatch (GhcPass p) (Located (body (GhcPass p)))
</span><a href="GHC.Hs.Utils.html#mkHsCaseAlt"><span class="hs-identifier hs-var">mkHsCaseAlt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkM1_P"><span class="hs-identifier hs-var">mkM1_P</span></a></span><span> </span><span class="annot"><span class="annottext">LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_Pat"><span class="hs-identifier hs-var">x_Pat</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(LHsExpr GhcPs -&gt; LMatch GhcPs (LHsExpr GhcPs))
-&gt; LHsExpr GhcPs -&gt; LMatch GhcPs (LHsExpr GhcPs)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; [LMatch GhcPs (LHsExpr GhcPs)] -&gt; LHsExpr GhcPs
</span><a href="GHC.Hs.Utils.html#nlHsCase"><span class="hs-identifier hs-var">nlHsCase</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_Expr"><span class="hs-identifier hs-var">x_Expr</span></a></span><span> </span><span class="annot"><span class="annottext">[LMatch GhcPs (LHsExpr GhcPs)]
</span><a href="#local-6989586621681171006"><span class="hs-identifier hs-var">to_matches</span></a></span><span>
</span><span id="line-346"></span><span>
</span><span id="line-347"></span><span>        </span><span id="local-6989586621681171008"><span class="annot"><span class="annottext">from_matches :: [LMatch GhcPs (LHsExpr GhcPs)]
</span><a href="#local-6989586621681171008"><span class="hs-identifier hs-var hs-var">from_matches</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LHsExpr GhcPs -&gt; LMatch GhcPs (LHsExpr GhcPs)
forall (p :: Pass) (body :: * -&gt; *).
LPat (GhcPass p)
-&gt; Located (body (GhcPass p))
-&gt; LMatch (GhcPass p) (Located (body (GhcPass p)))
</span><a href="GHC.Hs.Utils.html#mkHsCaseAlt"><span class="hs-identifier hs-var">mkHsCaseAlt</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcPs)
LPat GhcPs
</span><a href="#local-6989586621681171005"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681171004"><span class="hs-identifier hs-var">rhs</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681171005"><span class="annot"><span class="annottext">Located (Pat GhcPs)
</span><a href="#local-6989586621681171005"><span class="hs-identifier hs-var">pat</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681171004"><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681171004"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Located (Pat GhcPs), LHsExpr GhcPs)]
[Alt]
</span><a href="#local-6989586621681171003"><span class="hs-identifier hs-var">from_alts</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-348"></span><span>        </span><span id="local-6989586621681171006"><span class="annot"><span class="annottext">to_matches :: [LMatch GhcPs (LHsExpr GhcPs)]
</span><a href="#local-6989586621681171006"><span class="hs-identifier hs-var hs-var">to_matches</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LHsExpr GhcPs -&gt; LMatch GhcPs (LHsExpr GhcPs)
forall (p :: Pass) (body :: * -&gt; *).
LPat (GhcPass p)
-&gt; Located (body (GhcPass p))
-&gt; LMatch (GhcPass p) (Located (body (GhcPass p)))
</span><a href="GHC.Hs.Utils.html#mkHsCaseAlt"><span class="hs-identifier hs-var">mkHsCaseAlt</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcPs)
LPat GhcPs
</span><a href="#local-6989586621681171002"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681171001"><span class="hs-identifier hs-var">rhs</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681171002"><span class="annot"><span class="annottext">Located (Pat GhcPs)
</span><a href="#local-6989586621681171002"><span class="hs-identifier hs-var">pat</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681171001"><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681171001"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Located (Pat GhcPs), LHsExpr GhcPs)]
[Alt]
</span><a href="#local-6989586621681171000"><span class="hs-identifier hs-var">to_alts</span></a></span><span>  </span><span class="hs-special">]</span><span>
</span><span id="line-349"></span><span>        </span><span id="local-6989586621681171020"><span class="annot"><span class="annottext">loc :: SrcSpan
</span><a href="#local-6989586621681171020"><span class="hs-identifier hs-var hs-var">loc</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcLoc -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#srcLocSpan"><span class="hs-identifier hs-var">srcLocSpan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; SrcLoc
forall a. NamedThing a =&gt; a -&gt; SrcLoc
</span><a href="GHC.Types.Name.html#getSrcLoc"><span class="hs-identifier hs-var">getSrcLoc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171024"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-350"></span><span>        </span><span id="local-6989586621681170997"><span class="annot"><span class="annottext">datacons :: [DataCon]
</span><a href="#local-6989586621681170997"><span class="hs-identifier hs-var hs-var">datacons</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [DataCon]
</span><a href="GHC.Core.TyCon.html#tyConDataCons"><span class="hs-identifier hs-var">tyConDataCons</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171024"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-351"></span><span>
</span><span id="line-352"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681171019"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681171019"><span class="hs-identifier hs-var">from01_RDR</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681171016"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681171016"><span class="hs-identifier hs-var">to01_RDR</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681171025"><span class="hs-identifier hs-var">gk</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-353"></span><span>                                   </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0"><span class="hs-identifier hs-var">Gen0</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#from_RDR"><span class="hs-identifier hs-var">from_RDR</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#to_RDR"><span class="hs-identifier hs-var">to_RDR</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-354"></span><span>                                   </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen1"><span class="hs-identifier hs-var">Gen1</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#from1_RDR"><span class="hs-identifier hs-var">from1_RDR</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#to1_RDR"><span class="hs-identifier hs-var">to1_RDR</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-355"></span><span>
</span><span id="line-356"></span><span>        </span><span class="hs-comment">-- Recurse over the sum first</span><span>
</span><span id="line-357"></span><span>        </span><span class="annot"><a href="#local-6989586621681171003"><span class="hs-identifier hs-type">from_alts</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681171000"><span class="hs-identifier hs-type">to_alts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Alt"><span class="hs-identifier hs-type">Alt</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-358"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681171003"><span class="annot"><span class="annottext">[(Located (Pat GhcPs), LHsExpr GhcPs)]
[Alt]
</span><a href="#local-6989586621681171003"><span class="hs-identifier hs-var">from_alts</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681171000"><span class="annot"><span class="annottext">[(Located (Pat GhcPs), LHsExpr GhcPs)]
[Alt]
</span><a href="#local-6989586621681171000"><span class="hs-identifier hs-var">to_alts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenericKind_ -&gt; US -&gt; [DataCon] -&gt; ([Alt], [Alt])
</span><a href="GHC.Tc.Deriv.Generics.html#mkSum"><span class="hs-identifier hs-var">mkSum</span></a></span><span> </span><span class="annot"><span class="annottext">GenericKind_
</span><a href="#local-6989586621681170991"><span class="hs-identifier hs-var">gk_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">US
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#US"><span class="hs-identifier hs-type">US</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[DataCon]
</span><a href="#local-6989586621681170997"><span class="hs-identifier hs-var">datacons</span></a></span><span>
</span><span id="line-359"></span><span>          </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681170991"><span class="annot"><span class="annottext">gk_ :: GenericKind_
</span><a href="#local-6989586621681170991"><span class="hs-identifier hs-var hs-var">gk_</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681171025"><span class="hs-identifier hs-var">gk</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-360"></span><span>                  </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0"><span class="hs-identifier hs-var">Gen0</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">GenericKind_
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0_"><span class="hs-identifier hs-var">Gen0_</span></a></span><span>
</span><span id="line-361"></span><span>                  </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen1"><span class="hs-identifier hs-var">Gen1</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span class="hs-identifier">tyvars</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">lengthAtLeast</span><span class="hs-special">`</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
</span><span id="line-362"></span><span>                          </span><span class="annot"><span class="annottext">TyVar -&gt; GenericKind_
</span><a href="GHC.Tc.Deriv.Generics.html#Gen1_"><span class="hs-identifier hs-var">Gen1_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar] -&gt; TyVar
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#last"><span class="hs-identifier hs-var">last</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170989"><span class="hs-identifier hs-var">tyvars</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-363"></span><span>                    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681170989"><span class="annot"><span class="annottext">tyvars :: [TyVar]
</span><a href="#local-6989586621681170989"><span class="hs-identifier hs-var hs-var">tyvars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [TyVar]
</span><a href="GHC.Core.TyCon.html#tyConTyVars"><span class="hs-identifier hs-var hs-var">tyConTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681171024"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-364"></span><span>
</span><span id="line-365"></span><span class="hs-comment">--------------------------------------------------------------------------------</span><span>
</span><span id="line-366"></span><span class="hs-comment">-- The type synonym instance and synonym</span><span>
</span><span id="line-367"></span><span class="hs-comment">--       type instance Rep (D a b) = Rep_D a b</span><span>
</span><span id="line-368"></span><span class="hs-comment">--       type Rep_D a b = ...representation type for D ...</span><span>
</span><span id="line-369"></span><span class="hs-comment">--------------------------------------------------------------------------------</span><span>
</span><span id="line-370"></span><span>
</span><span id="line-371"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#tc_mkRepFamInsts"><span class="hs-identifier hs-type">tc_mkRepFamInsts</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind"><span class="hs-identifier hs-type">GenericKind</span></a></span><span>   </span><span class="hs-comment">-- Gen0 or Gen1</span><span>
</span><span id="line-372"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>         </span><span class="hs-comment">-- The type to generate representation for</span><span>
</span><span id="line-373"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span>        </span><span class="hs-comment">-- The type(s) to which Generic(1) is applied</span><span>
</span><span id="line-374"></span><span>                                  </span><span class="hs-comment">-- in the generated instance</span><span>
</span><span id="line-375"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInst"><span class="hs-identifier hs-type">FamInst</span></a></span><span>   </span><span class="hs-comment">-- Generated representation0 coercion</span><span>
</span><span id="line-376"></span><span id="tc_mkRepFamInsts"><span class="annot"><span class="annottext">tc_mkRepFamInsts :: GenericKind -&gt; TyCon -&gt; [Type] -&gt; TcM FamInst
</span><a href="GHC.Tc.Deriv.Generics.html#tc_mkRepFamInsts"><span class="hs-identifier hs-var hs-var">tc_mkRepFamInsts</span></a></span></span><span> </span><span id="local-6989586621681170986"><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681170986"><span class="hs-identifier hs-var">gk</span></a></span></span><span> </span><span id="local-6989586621681170985"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170985"><span class="hs-identifier hs-var">tycon</span></a></span></span><span> </span><span id="local-6989586621681170984"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170984"><span class="hs-identifier hs-var">inst_tys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-377"></span><span>       </span><span class="hs-comment">-- Consider the example input tycon `D`, where data D a b = D_ a</span><span>
</span><span id="line-378"></span><span>       </span><span class="hs-comment">-- Also consider `R:DInt`, where { data family D x y :: * -&gt; *</span><span>
</span><span id="line-379"></span><span>       </span><span class="hs-comment">--                               ; data instance D Int a b = D_ a }</span><span>
</span><span id="line-380"></span><span>  </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-comment">-- `rep` = GHC.Generics.Rep or GHC.Generics.Rep1 (type family)</span><span>
</span><span id="line-381"></span><span>       </span><span id="local-6989586621681170983"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170983"><span class="hs-identifier hs-var">fam_tc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681170986"><span class="hs-identifier hs-var">gk</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-382"></span><span>         </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0"><span class="hs-identifier hs-var">Gen0</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#repTyConName"><span class="hs-identifier hs-var">repTyConName</span></a></span><span>
</span><span id="line-383"></span><span>         </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen1"><span class="hs-identifier hs-var">Gen1</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#rep1TyConName"><span class="hs-identifier hs-var">rep1TyConName</span></a></span><span>
</span><span id="line-384"></span><span>
</span><span id="line-385"></span><span>     </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681170979"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681170979"><span class="hs-identifier hs-var">fam_envs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM FamInstEnvs
</span><a href="GHC.Tc.Instance.Family.html#tcGetFamInstEnvs"><span class="hs-identifier hs-var">tcGetFamInstEnvs</span></a></span><span>
</span><span id="line-386"></span><span>
</span><span id="line-387"></span><span>     </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-comment">-- If the derived instance is</span><span>
</span><span id="line-388"></span><span>           </span><span class="hs-comment">--   instance Generic (Foo x)</span><span>
</span><span id="line-389"></span><span>           </span><span class="hs-comment">-- then:</span><span>
</span><span id="line-390"></span><span>           </span><span class="hs-comment">--   `arg_ki` = *, `inst_ty` = Foo x :: *</span><span>
</span><span id="line-391"></span><span>           </span><span class="hs-comment">--</span><span>
</span><span id="line-392"></span><span>           </span><span class="hs-comment">-- If the derived instance is</span><span>
</span><span id="line-393"></span><span>           </span><span class="hs-comment">--   instance Generic1 (Bar x :: k -&gt; *)</span><span>
</span><span id="line-394"></span><span>           </span><span class="hs-comment">-- then:</span><span>
</span><span id="line-395"></span><span>           </span><span class="hs-comment">--   `arg_k` = k, `inst_ty` = Bar x :: k -&gt; *</span><span>
</span><span id="line-396"></span><span>           </span><span class="hs-special">(</span><span id="local-6989586621681170977"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170977"><span class="hs-identifier hs-var">arg_ki</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681170976"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170976"><span class="hs-identifier hs-var">inst_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681170986"><span class="hs-identifier hs-var">gk</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170984"><span class="hs-identifier hs-var">inst_tys</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-397"></span><span>             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0"><span class="hs-identifier hs-var">Gen0</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681170975"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170975"><span class="hs-identifier hs-var">inst_t</span></a></span></span><span class="hs-special">]</span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#liftedTypeKind"><span class="hs-identifier hs-var">liftedTypeKind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170975"><span class="hs-identifier hs-var">inst_t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-398"></span><span>             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen1"><span class="hs-identifier hs-var">Gen1</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681170973"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170973"><span class="hs-identifier hs-var">arg_k</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681170972"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170972"><span class="hs-identifier hs-var">inst_t</span></a></span></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170973"><span class="hs-identifier hs-var">arg_k</span></a></span><span class="hs-special">,</span><span>          </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170972"><span class="hs-identifier hs-var">inst_t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-399"></span><span>             </span><span class="annot"><span class="annottext">(GenericKind, [Type])
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc -&gt; (Type, Type)
forall a. HasCallStack =&gt; String -&gt; MsgDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tc_mkRepFamInsts&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type] -&gt; MsgDoc
forall a. Outputable a =&gt; a -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170984"><span class="hs-identifier hs-var">inst_tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-400"></span><span>
</span><span id="line-401"></span><span>     </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681170970"><span class="annot"><span class="annottext">mbFamInst :: Maybe (TyCon, [Type])
</span><a href="#local-6989586621681170970"><span class="hs-identifier hs-var hs-var">mbFamInst</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.TyCon.html#tyConFamInst_maybe"><span class="hs-identifier hs-var">tyConFamInst_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170985"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-402"></span><span>           </span><span class="hs-comment">-- If we're examining a data family instance, we grab the parent</span><span>
</span><span id="line-403"></span><span>           </span><span class="hs-comment">-- TyCon (ptc) and use it to determine the type arguments</span><span>
</span><span id="line-404"></span><span>           </span><span class="hs-comment">-- (inst_args) for the data family *instance*'s type variables.</span><span>
</span><span id="line-405"></span><span>           </span><span id="local-6989586621681170969"><span class="annot"><span class="annottext">ptc :: TyCon
</span><a href="#local-6989586621681170969"><span class="hs-identifier hs-var hs-var">ptc</span></a></span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon
-&gt; ((TyCon, [Type]) -&gt; TyCon) -&gt; Maybe (TyCon, [Type]) -&gt; TyCon
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170985"><span class="hs-identifier hs-var">tycon</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon, [Type]) -&gt; TyCon
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (TyCon, [Type])
</span><a href="#local-6989586621681170970"><span class="hs-identifier hs-var">mbFamInst</span></a></span><span>
</span><span id="line-406"></span><span>           </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681170967"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170967"><span class="hs-identifier hs-var">inst_args</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Coercion
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs -&gt; TyCon -&gt; [Type] -&gt; (TyCon, [Type], Coercion)
</span><a href="GHC.Tc.Instance.Family.html#tcLookupDataFamInst"><span class="hs-identifier hs-var">tcLookupDataFamInst</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681170979"><span class="hs-identifier hs-var">fam_envs</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170969"><span class="hs-identifier hs-var">ptc</span></a></span><span> </span><span class="annot"><span class="annottext">([Type] -&gt; (TyCon, [Type], Coercion))
-&gt; [Type] -&gt; (TyCon, [Type], Coercion)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon, [Type]) -&gt; [Type]
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span>
</span><span id="line-407"></span><span>                                 </span><span class="annot"><span class="annottext">((TyCon, [Type]) -&gt; [Type]) -&gt; (TyCon, [Type]) -&gt; [Type]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; (TyCon, [Type])
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitTyConApp"><span class="hs-identifier hs-var">tcSplitTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170976"><span class="hs-identifier hs-var">inst_ty</span></a></span><span>
</span><span id="line-408"></span><span>
</span><span id="line-409"></span><span>     </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-comment">-- `tyvars` = [a,b]</span><span>
</span><span id="line-410"></span><span>           </span><span class="hs-special">(</span><span id="local-6989586621681170964"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170964"><span class="hs-identifier hs-var">tyvars</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681170963"><span class="annot"><span class="annottext">GenericKind_
</span><a href="#local-6989586621681170963"><span class="hs-identifier hs-var">gk_</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681170986"><span class="hs-identifier hs-var">gk</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-411"></span><span>             </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0"><span class="hs-identifier hs-var">Gen0</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170962"><span class="hs-identifier hs-var">all_tyvars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">GenericKind_
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0_"><span class="hs-identifier hs-var">Gen0_</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-412"></span><span>             </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen1"><span class="hs-identifier hs-var">Gen1</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span class="hs-identifier">not</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">null</span><span> </span><span class="hs-identifier">all_tyvars</span><span class="hs-special">)</span><span>
</span><span id="line-413"></span><span>                     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar] -&gt; [TyVar]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#init"><span class="hs-identifier hs-var">init</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170962"><span class="hs-identifier hs-var">all_tyvars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; GenericKind_
</span><a href="GHC.Tc.Deriv.Generics.html#Gen1_"><span class="hs-identifier hs-var">Gen1_</span></a></span><span> </span><span class="annot"><span class="annottext">(TyVar -&gt; GenericKind_) -&gt; TyVar -&gt; GenericKind_
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; TyVar
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#last"><span class="hs-identifier hs-var">last</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170962"><span class="hs-identifier hs-var">all_tyvars</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-414"></span><span>             </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681170962"><span class="annot"><span class="annottext">all_tyvars :: [TyVar]
</span><a href="#local-6989586621681170962"><span class="hs-identifier hs-var hs-var">all_tyvars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [TyVar]
</span><a href="GHC.Core.TyCon.html#tyConTyVars"><span class="hs-identifier hs-var hs-var">tyConTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170985"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-415"></span><span>
</span><span id="line-416"></span><span>       </span><span class="hs-comment">-- `repTy` = D1 ... (C1 ... (S1 ... (Rec0 a))) :: * -&gt; *</span><span>
</span><span id="line-417"></span><span>     </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681170961"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170961"><span class="hs-identifier hs-var">repTy</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GenericKind_ -&gt; TyCon -&gt; Type -&gt; TcM Type
</span><a href="GHC.Tc.Deriv.Generics.html#tc_mkRepTy"><span class="hs-identifier hs-var">tc_mkRepTy</span></a></span><span> </span><span class="annot"><span class="annottext">GenericKind_
</span><a href="#local-6989586621681170963"><span class="hs-identifier hs-var">gk_</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170985"><span class="hs-identifier hs-var">tycon</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170977"><span class="hs-identifier hs-var">arg_ki</span></a></span><span>
</span><span id="line-418"></span><span>
</span><span id="line-419"></span><span>       </span><span class="hs-comment">-- `rep_name` is a name we generate for the synonym</span><span>
</span><span id="line-420"></span><span>     </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681170959"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681170959"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) Module
forall (m :: * -&gt; *). HasModule m =&gt; m Module
</span><a href="GHC.Unit.Module.html#getModule"><span class="hs-identifier hs-var">getModule</span></a></span><span>
</span><span id="line-421"></span><span>     </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681170958"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681170958"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRn SrcSpan
</span><a href="GHC.Tc.Utils.Monad.html#getSrcSpanM"><span class="hs-identifier hs-var">getSrcSpanM</span></a></span><span>
</span><span id="line-422"></span><span>     </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681170956"><span class="annot"><span class="annottext">tc_occ :: OccName
</span><a href="#local-6989586621681170956"><span class="hs-identifier hs-var hs-var">tc_occ</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Name
</span><a href="GHC.Core.TyCon.html#tyConName"><span class="hs-identifier hs-var hs-var">tyConName</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170985"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-423"></span><span>           </span><span id="local-6989586621681170953"><span class="annot"><span class="annottext">rep_occ :: OccName
</span><a href="#local-6989586621681170953"><span class="hs-identifier hs-var hs-var">rep_occ</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681170986"><span class="hs-identifier hs-var">gk</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0"><span class="hs-identifier hs-var">Gen0</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkGenR"><span class="hs-identifier hs-var">mkGenR</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681170956"><span class="hs-identifier hs-var">tc_occ</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen1"><span class="hs-identifier hs-var">Gen1</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkGen1R"><span class="hs-identifier hs-var">mkGen1R</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681170956"><span class="hs-identifier hs-var">tc_occ</span></a></span><span>
</span><span id="line-424"></span><span>     </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681170950"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681170950"><span class="hs-identifier hs-var">rep_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Module -&gt; OccName -&gt; SrcSpan -&gt; TcRnIf TcGblEnv TcLclEnv Name
forall a b. Module -&gt; OccName -&gt; SrcSpan -&gt; TcRnIf a b Name
</span><a href="GHC.Iface.Env.html#newGlobalBinder"><span class="hs-identifier hs-var">newGlobalBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681170959"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681170953"><span class="hs-identifier hs-var">rep_occ</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681170958"><span class="hs-identifier hs-var">loc</span></a></span><span>
</span><span id="line-425"></span><span>
</span><span id="line-426"></span><span>       </span><span class="hs-comment">-- We make sure to substitute the tyvars with their user-supplied</span><span>
</span><span id="line-427"></span><span>       </span><span class="hs-comment">-- type arguments before generating the Rep/Rep1 instance, since some</span><span>
</span><span id="line-428"></span><span>       </span><span class="hs-comment">-- of the tyvars might have been instantiated when deriving.</span><span>
</span><span id="line-429"></span><span>       </span><span class="hs-comment">-- See Note [Generating a correctly typed Rep instance].</span><span>
</span><span id="line-430"></span><span>     </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681170949"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170949"><span class="hs-identifier hs-var">env_tyvars</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681170948"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170948"><span class="hs-identifier hs-var">env_inst_args</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-431"></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">GenericKind_
</span><a href="#local-6989586621681170963"><span class="hs-identifier hs-var">gk_</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-432"></span><span>                 </span><span class="annot"><span class="annottext">GenericKind_
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0_"><span class="hs-identifier hs-var">Gen0_</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170964"><span class="hs-identifier hs-var">tyvars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170967"><span class="hs-identifier hs-var">inst_args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-433"></span><span>                 </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen1_"><span class="hs-identifier hs-type">Gen1_</span></a></span><span> </span><span id="local-6989586621681170947"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170947"><span class="hs-identifier hs-var">last_tv</span></a></span></span><span>
</span><span id="line-434"></span><span>                          </span><span class="hs-comment">-- See the &quot;wrinkle&quot; in</span><span>
</span><span id="line-435"></span><span>                          </span><span class="hs-comment">-- Note [Generating a correctly typed Rep instance]</span><span>
</span><span id="line-436"></span><span>                       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170947"><span class="hs-identifier hs-var">last_tv</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; [TyVar] -&gt; [TyVar]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170964"><span class="hs-identifier hs-var">tyvars</span></a></span><span>
</span><span id="line-437"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type
</span><a href="GHC.Builtin.Types.html#anyTypeOfKind"><span class="hs-identifier hs-var">anyTypeOfKind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar -&gt; Type
</span><a href="GHC.Types.Var.html#tyVarKind"><span class="hs-identifier hs-var">tyVarKind</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170947"><span class="hs-identifier hs-var">last_tv</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [Type] -&gt; [Type]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170967"><span class="hs-identifier hs-var">inst_args</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-438"></span><span>           </span><span id="local-6989586621681170944"><span class="annot"><span class="annottext">env :: TvSubstEnv
</span><a href="#local-6989586621681170944"><span class="hs-identifier hs-var hs-var">env</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [Type] -&gt; TvSubstEnv
HasDebugCallStack =&gt; [TyVar] -&gt; [Type] -&gt; TvSubstEnv
</span><a href="GHC.Core.TyCo.Subst.html#zipTyEnv"><span class="hs-identifier hs-var">zipTyEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170949"><span class="hs-identifier hs-var">env_tyvars</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170948"><span class="hs-identifier hs-var">env_inst_args</span></a></span><span>
</span><span id="line-439"></span><span>           </span><span id="local-6989586621681170942"><span class="annot"><span class="annottext">in_scope :: InScopeSet
</span><a href="#local-6989586621681170942"><span class="hs-identifier hs-var hs-var">in_scope</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">VarSet -&gt; InScopeSet
</span><a href="GHC.Types.Var.Env.html#mkInScopeSet"><span class="hs-identifier hs-var">mkInScopeSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type] -&gt; VarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypes"><span class="hs-identifier hs-var">tyCoVarsOfTypes</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170984"><span class="hs-identifier hs-var">inst_tys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-440"></span><span>           </span><span id="local-6989586621681170939"><span class="annot"><span class="annottext">subst :: TCvSubst
</span><a href="#local-6989586621681170939"><span class="hs-identifier hs-var hs-var">subst</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; TvSubstEnv -&gt; TCvSubst
</span><a href="GHC.Core.TyCo.Subst.html#mkTvSubst"><span class="hs-identifier hs-var">mkTvSubst</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621681170942"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">TvSubstEnv
</span><a href="#local-6989586621681170944"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-441"></span><span>           </span><span id="local-6989586621681170937"><span class="annot"><span class="annottext">repTy' :: Type
</span><a href="#local-6989586621681170937"><span class="hs-identifier hs-var hs-var">repTy'</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TCvSubst -&gt; Type -&gt; Type
</span><a href="GHC.Core.TyCo.Subst.html#substTyUnchecked"><span class="hs-identifier hs-var">substTyUnchecked</span></a></span><span>  </span><span class="annot"><span class="annottext">TCvSubst
</span><a href="#local-6989586621681170939"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170961"><span class="hs-identifier hs-var">repTy</span></a></span><span>
</span><span id="line-442"></span><span>           </span><span id="local-6989586621681170935"><span class="annot"><span class="annottext">tcv' :: [TyVar]
</span><a href="#local-6989586621681170935"><span class="hs-identifier hs-var hs-var">tcv'</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; [TyVar]
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypeList"><span class="hs-identifier hs-var">tyCoVarsOfTypeList</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170976"><span class="hs-identifier hs-var">inst_ty</span></a></span><span>
</span><span id="line-443"></span><span>           </span><span class="hs-special">(</span><span id="local-6989586621681170933"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170933"><span class="hs-identifier hs-var">tv'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681170932"><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170932"><span class="hs-identifier hs-var">cv'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyVar -&gt; Bool) -&gt; [TyVar] -&gt; ([TyVar], [TyVar])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170935"><span class="hs-identifier hs-var">tcv'</span></a></span><span>
</span><span id="line-444"></span><span>           </span><span id="local-6989586621681170930"><span class="annot"><span class="annottext">tvs' :: [TyVar]
</span><a href="#local-6989586621681170930"><span class="hs-identifier hs-var hs-var">tvs'</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [TyVar]
</span><a href="GHC.Core.TyCo.FVs.html#scopedSort"><span class="hs-identifier hs-var">scopedSort</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170933"><span class="hs-identifier hs-var">tv'</span></a></span><span>
</span><span id="line-445"></span><span>           </span><span id="local-6989586621681170928"><span class="annot"><span class="annottext">cvs' :: [TyVar]
</span><a href="#local-6989586621681170928"><span class="hs-identifier hs-var hs-var">cvs'</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [TyVar]
</span><a href="GHC.Core.TyCo.FVs.html#scopedSort"><span class="hs-identifier hs-var">scopedSort</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170932"><span class="hs-identifier hs-var">cv'</span></a></span><span>
</span><span id="line-446"></span><span>           </span><span id="local-6989586621681170927"><span class="annot"><span class="annottext">axiom :: CoAxiom Unbranched
</span><a href="#local-6989586621681170927"><span class="hs-identifier hs-var hs-var">axiom</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role
-&gt; Name
-&gt; [TyVar]
-&gt; [TyVar]
-&gt; [TyVar]
-&gt; TyCon
-&gt; [Type]
-&gt; Type
-&gt; CoAxiom Unbranched
</span><a href="GHC.Core.FamInstEnv.html#mkSingleCoAxiom"><span class="hs-identifier hs-var">mkSingleCoAxiom</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681170950"><span class="hs-identifier hs-var">rep_name</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170930"><span class="hs-identifier hs-var">tvs'</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[TyVar]
</span><a href="#local-6989586621681170928"><span class="hs-identifier hs-var">cvs'</span></a></span><span>
</span><span id="line-447"></span><span>                                        </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170983"><span class="hs-identifier hs-var">fam_tc</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170984"><span class="hs-identifier hs-var">inst_tys</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170937"><span class="hs-identifier hs-var">repTy'</span></a></span><span>
</span><span id="line-448"></span><span>
</span><span id="line-449"></span><span>     </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">FamFlavor -&gt; CoAxiom Unbranched -&gt; TcM FamInst
</span><a href="GHC.Tc.Instance.Family.html#newFamInst"><span class="hs-identifier hs-var">newFamInst</span></a></span><span> </span><span class="annot"><span class="annottext">FamFlavor
</span><a href="GHC.Core.FamInstEnv.html#SynFamilyInst"><span class="hs-identifier hs-var">SynFamilyInst</span></a></span><span> </span><span class="annot"><span class="annottext">CoAxiom Unbranched
</span><a href="#local-6989586621681170927"><span class="hs-identifier hs-var">axiom</span></a></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-450"></span><span>
</span><span id="line-451"></span><span class="hs-comment">--------------------------------------------------------------------------------</span><span>
</span><span id="line-452"></span><span class="hs-comment">-- Type representation</span><span>
</span><span id="line-453"></span><span class="hs-comment">--------------------------------------------------------------------------------</span><span>
</span><span id="line-454"></span><span>
</span><span id="line-455"></span><span class="hs-comment">-- | See documentation of 'argTyFold'; that function uses the fields of this</span><span>
</span><span id="line-456"></span><span class="hs-comment">-- type to interpret the structure of a type when that type is considered as an</span><span>
</span><span id="line-457"></span><span class="hs-comment">-- argument to a constructor that is being represented with 'Rep1'.</span><span>
</span><span id="line-458"></span><span class="hs-keyword">data</span><span> </span><span id="ArgTyAlg"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#ArgTyAlg"><span class="hs-identifier hs-var">ArgTyAlg</span></a></span></span><span> </span><span id="local-6989586621681171448"><span class="annot"><a href="#local-6989586621681171448"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="ArgTyAlg"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#ArgTyAlg"><span class="hs-identifier hs-var">ArgTyAlg</span></a></span></span><span>
</span><span id="line-459"></span><span>  </span><span class="hs-special">{</span><span> </span><span id="ata_rec0"><span class="annot"><span class="annottext">forall a. ArgTyAlg a -&gt; Type -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec0"><span class="hs-identifier hs-var hs-var">ata_rec0</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681171448"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-460"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="ata_par1"><span class="annot"><span class="annottext">forall a. ArgTyAlg a -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#ata_par1"><span class="hs-identifier hs-var hs-var">ata_par1</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621681171448"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span id="ata_rec1"><span class="annot"><span class="annottext">forall a. ArgTyAlg a -&gt; Type -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec1"><span class="hs-identifier hs-var hs-var">ata_rec1</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681171448"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-461"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="ata_comp"><span class="annot"><span class="annottext">forall a. ArgTyAlg a -&gt; Type -&gt; a -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#ata_comp"><span class="hs-identifier hs-var hs-var">ata_comp</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681171448"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681171448"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-462"></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-463"></span><span>
</span><span id="line-464"></span><span class="hs-comment">-- | @argTyFold@ implements a generalised and safer variant of the @arg@</span><span>
</span><span id="line-465"></span><span class="hs-comment">-- function from Figure 3 in &lt;http://dreixel.net/research/pdf/gdmh.pdf&gt;. @arg@</span><span>
</span><span id="line-466"></span><span class="hs-comment">-- is conceptually equivalent to:</span><span>
</span><span id="line-467"></span><span class="hs-comment">--</span><span>
</span><span id="line-468"></span><span class="hs-comment">-- &gt; arg t = case t of</span><span>
</span><span id="line-469"></span><span class="hs-comment">-- &gt;   _ | isTyVar t         -&gt; if (t == argVar) then Par1 else Par0 t</span><span>
</span><span id="line-470"></span><span class="hs-comment">-- &gt;   App f [t'] |</span><span>
</span><span id="line-471"></span><span class="hs-comment">-- &gt;     representable1 f &amp;&amp;</span><span>
</span><span id="line-472"></span><span class="hs-comment">-- &gt;     t' == argVar        -&gt; Rec1 f</span><span>
</span><span id="line-473"></span><span class="hs-comment">-- &gt;   App f [t'] |</span><span>
</span><span id="line-474"></span><span class="hs-comment">-- &gt;     representable1 f &amp;&amp;</span><span>
</span><span id="line-475"></span><span class="hs-comment">-- &gt;     t' has tyvars       -&gt; f :.: (arg t')</span><span>
</span><span id="line-476"></span><span class="hs-comment">-- &gt;   _                     -&gt; Rec0 t</span><span>
</span><span id="line-477"></span><span class="hs-comment">--</span><span>
</span><span id="line-478"></span><span class="hs-comment">-- where @argVar@ is the last type variable in the data type declaration we are</span><span>
</span><span id="line-479"></span><span class="hs-comment">-- finding the representation for.</span><span>
</span><span id="line-480"></span><span class="hs-comment">--</span><span>
</span><span id="line-481"></span><span class="hs-comment">-- @argTyFold@ is more general than @arg@ because it uses 'ArgTyAlg' to</span><span>
</span><span id="line-482"></span><span class="hs-comment">-- abstract out the concrete invocations of @Par0@, @Rec0@, @Par1@, @Rec1@, and</span><span>
</span><span id="line-483"></span><span class="hs-comment">-- @:.:@.</span><span>
</span><span id="line-484"></span><span class="hs-comment">--</span><span>
</span><span id="line-485"></span><span class="hs-comment">-- @argTyFold@ is safer than @arg@ because @arg@ would lead to a GHC panic for</span><span>
</span><span id="line-486"></span><span class="hs-comment">-- some data types. The problematic case is when @t@ is an application of a</span><span>
</span><span id="line-487"></span><span class="hs-comment">-- non-representable type @f@ to @argVar@: @App f [argVar]@ is caught by the</span><span>
</span><span id="line-488"></span><span class="hs-comment">-- @_@ pattern, and ends up represented as @Rec0 t@. This type occurs /free/ in</span><span>
</span><span id="line-489"></span><span class="hs-comment">-- the RHS of the eventual @Rep1@ instance, which is therefore ill-formed. Some</span><span>
</span><span id="line-490"></span><span class="hs-comment">-- representable1 checks have been relaxed, and others were moved to</span><span>
</span><span id="line-491"></span><span class="hs-comment">-- @canDoGenerics1@.</span><span>
</span><span id="line-492"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#argTyFold"><span class="hs-identifier hs-type">argTyFold</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621681171452"><span class="annot"><a href="#local-6989586621681171452"><span class="hs-identifier hs-type">a</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#ArgTyAlg"><span class="hs-identifier hs-type">ArgTyAlg</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681171452"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681171452"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-493"></span><span id="argTyFold"><span class="annot"><span class="annottext">argTyFold :: forall a. TyVar -&gt; ArgTyAlg a -&gt; Type -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#argTyFold"><span class="hs-identifier hs-var hs-var">argTyFold</span></a></span></span><span> </span><span id="local-6989586621681170913"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170913"><span class="hs-identifier hs-var">argVar</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#ArgTyAlg"><span class="hs-identifier hs-type">ArgTyAlg</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">ata_rec0 :: forall a. ArgTyAlg a -&gt; Type -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec0"><span class="hs-identifier hs-var">ata_rec0</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681170912"><span class="annot"><span class="annottext">Type -&gt; a
</span><a href="#local-6989586621681170912"><span class="hs-identifier hs-var">mkRec0</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-494"></span><span>                            </span><span class="annot"><span class="annottext">ata_par1 :: forall a. ArgTyAlg a -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#ata_par1"><span class="hs-identifier hs-var">ata_par1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681170911"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681170911"><span class="hs-identifier hs-var">mkPar1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ata_rec1 :: forall a. ArgTyAlg a -&gt; Type -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec1"><span class="hs-identifier hs-var">ata_rec1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681170910"><span class="annot"><span class="annottext">Type -&gt; a
</span><a href="#local-6989586621681170910"><span class="hs-identifier hs-var">mkRec1</span></a></span></span><span class="hs-special">,</span><span>
</span><span id="line-495"></span><span>                            </span><span class="annot"><span class="annottext">ata_comp :: forall a. ArgTyAlg a -&gt; Type -&gt; a -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#ata_comp"><span class="hs-identifier hs-var">ata_comp</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681170909"><span class="annot"><span class="annottext">Type -&gt; a -&gt; a
</span><a href="#local-6989586621681170909"><span class="hs-identifier hs-var">mkComp</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-496"></span><span>  </span><span class="hs-comment">-- mkRec0 is the default; use it if there is no interesting structure</span><span>
</span><span id="line-497"></span><span>  </span><span class="hs-comment">-- (e.g. occurrences of parameters or recursive occurrences)</span><span>
</span><span id="line-498"></span><span>  </span><span class="hs-glyph">\</span><span id="local-6989586621681170908"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170908"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; (a -&gt; a) -&gt; Maybe a -&gt; a
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; a
</span><a href="#local-6989586621681170912"><span class="hs-identifier hs-var">mkRec0</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170908"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe a -&gt; a) -&gt; Maybe a -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe a
</span><a href="#local-6989586621681170906"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170908"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-499"></span><span>  </span><span class="annot"><a href="#local-6989586621681170906"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-comment">-- type to fold through</span><span>
</span><span id="line-500"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681171452"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-comment">-- the result (e.g. representation type), unless it's trivial</span><span>
</span><span id="line-501"></span><span>  </span><span id="local-6989586621681170906"><span class="annot"><span class="annottext">go :: Type -&gt; Maybe a
</span><a href="#local-6989586621681170906"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621681170905"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170905"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621681170904"><span class="hs-identifier hs-var">isParam</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Maybe a -&gt; Maybe a
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a -&gt; m a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-operator hs-var">`mplus`</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621681170903"><span class="hs-identifier hs-var">isApp</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-502"></span><span>
</span><span id="line-503"></span><span>    </span><span id="local-6989586621681170904"><span class="annot"><span class="annottext">isParam :: Maybe a
</span><a href="#local-6989586621681170904"><span class="hs-identifier hs-var hs-var">isParam</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-comment">-- handles parameters</span><span>
</span><span id="line-504"></span><span>      </span><span id="local-6989586621681170902"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170902"><span class="hs-identifier hs-var">t'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe TyVar
</span><a href="GHC.Core.Type.html#getTyVar_maybe"><span class="hs-identifier hs-var">getTyVar_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170905"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-505"></span><span>      </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Maybe a) -&gt; a -&gt; Maybe a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170902"><span class="hs-identifier hs-var">t'</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; TyVar -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170913"><span class="hs-identifier hs-var">argVar</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681170911"><span class="hs-identifier hs-var">mkPar1</span></a></span><span> </span><span class="hs-comment">-- moreover, it is &quot;the&quot; parameter</span><span>
</span><span id="line-506"></span><span>             </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Type -&gt; a
</span><a href="#local-6989586621681170912"><span class="hs-identifier hs-var">mkRec0</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170905"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-comment">-- NB mkRec0 instead of the conventional mkPar0</span><span>
</span><span id="line-507"></span><span>
</span><span id="line-508"></span><span>    </span><span id="local-6989586621681170903"><span class="annot"><span class="annottext">isApp :: Maybe a
</span><a href="#local-6989586621681170903"><span class="hs-identifier hs-var hs-var">isApp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-comment">-- handles applications</span><span>
</span><span id="line-509"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621681170900"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170900"><span class="hs-identifier hs-var">phi</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681170899"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170899"><span class="hs-identifier hs-var">beta</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type)
</span><a href="GHC.Tc.Utils.TcType.html#tcSplitAppTy_maybe"><span class="hs-identifier hs-var">tcSplitAppTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170905"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-510"></span><span>
</span><span id="line-511"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681170897"><span class="annot"><span class="annottext">interesting :: Bool
</span><a href="#local-6989586621681170897"><span class="hs-identifier hs-var hs-var">interesting</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170913"><span class="hs-identifier hs-var">argVar</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; VarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#elemVarSet"><span class="hs-operator hs-var">`elemVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; VarSet
</span><a href="GHC.Tc.Utils.TcType.html#exactTyCoVarsOfType"><span class="hs-identifier hs-var">exactTyCoVarsOfType</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170899"><span class="hs-identifier hs-var">beta</span></a></span><span>
</span><span id="line-512"></span><span>
</span><span id="line-513"></span><span>      </span><span class="hs-comment">-- Does it have no interesting structure to represent?</span><span>
</span><span id="line-514"></span><span>      </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681170897"><span class="hs-identifier hs-var">interesting</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-515"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="hs-comment">-- Is the argument the parameter? Special case for mkRec1.</span><span>
</span><span id="line-516"></span><span>          </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; Maybe TyVar
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170913"><span class="hs-identifier hs-var">argVar</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe TyVar -&gt; Maybe TyVar -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe TyVar
</span><a href="GHC.Core.Type.html#getTyVar_maybe"><span class="hs-identifier hs-var">getTyVar_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170899"><span class="hs-identifier hs-var">beta</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Maybe a) -&gt; a -&gt; Maybe a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; a
</span><a href="#local-6989586621681170910"><span class="hs-identifier hs-var">mkRec1</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170900"><span class="hs-identifier hs-var">phi</span></a></span><span>
</span><span id="line-517"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Type -&gt; a -&gt; a
</span><a href="#local-6989586621681170909"><span class="hs-identifier hs-var">mkComp</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170900"><span class="hs-identifier hs-var">phi</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; a) -&gt; Maybe a -&gt; Maybe a
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-operator hs-var">`fmap`</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe a
</span><a href="#local-6989586621681170906"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170899"><span class="hs-identifier hs-var">beta</span></a></span><span> </span><span class="hs-comment">-- It must be a composition.</span><span>
</span><span id="line-518"></span><span>
</span><span id="line-519"></span><span>
</span><span id="line-520"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#tc_mkRepTy"><span class="hs-identifier hs-type">tc_mkRepTy</span></a></span><span> </span><span class="hs-glyph">::</span><span>  </span><span class="hs-comment">-- Gen0_ or Gen1_, for Rep or Rep1</span><span>
</span><span id="line-521"></span><span>               </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind_"><span class="hs-identifier hs-type">GenericKind_</span></a></span><span>
</span><span id="line-522"></span><span>              </span><span class="hs-comment">-- The type to generate representation for</span><span>
</span><span id="line-523"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>
</span><span id="line-524"></span><span>              </span><span class="hs-comment">-- The kind of the representation type's argument</span><span>
</span><span id="line-525"></span><span>              </span><span class="hs-comment">-- See Note [Handling kinds in a Rep instance]</span><span>
</span><span id="line-526"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span>
</span><span id="line-527"></span><span>               </span><span class="hs-comment">-- Generated representation0 type</span><span>
</span><span id="line-528"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-529"></span><span id="tc_mkRepTy"><span class="annot"><span class="annottext">tc_mkRepTy :: GenericKind_ -&gt; TyCon -&gt; Type -&gt; TcM Type
</span><a href="GHC.Tc.Deriv.Generics.html#tc_mkRepTy"><span class="hs-identifier hs-var hs-var">tc_mkRepTy</span></a></span></span><span> </span><span id="local-6989586621681170894"><span class="annot"><span class="annottext">GenericKind_
</span><a href="#local-6989586621681170894"><span class="hs-identifier hs-var">gk_</span></a></span></span><span> </span><span id="local-6989586621681170893"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170893"><span class="hs-identifier hs-var">tycon</span></a></span></span><span> </span><span id="local-6989586621681170892"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170892"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-530"></span><span>  </span><span class="hs-keyword">do</span><span>
</span><span id="line-531"></span><span>    </span><span id="local-6989586621681170891"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170891"><span class="hs-identifier hs-var">d1</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#d1TyConName"><span class="hs-identifier hs-var">d1TyConName</span></a></span><span>
</span><span id="line-532"></span><span>    </span><span id="local-6989586621681170889"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170889"><span class="hs-identifier hs-var">c1</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#c1TyConName"><span class="hs-identifier hs-var">c1TyConName</span></a></span><span>
</span><span id="line-533"></span><span>    </span><span id="local-6989586621681170887"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170887"><span class="hs-identifier hs-var">s1</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#s1TyConName"><span class="hs-identifier hs-var">s1TyConName</span></a></span><span>
</span><span id="line-534"></span><span>    </span><span id="local-6989586621681170885"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170885"><span class="hs-identifier hs-var">rec0</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#rec0TyConName"><span class="hs-identifier hs-var">rec0TyConName</span></a></span><span>
</span><span id="line-535"></span><span>    </span><span id="local-6989586621681170883"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170883"><span class="hs-identifier hs-var">rec1</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#rec1TyConName"><span class="hs-identifier hs-var">rec1TyConName</span></a></span><span>
</span><span id="line-536"></span><span>    </span><span id="local-6989586621681170881"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170881"><span class="hs-identifier hs-var">par1</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#par1TyConName"><span class="hs-identifier hs-var">par1TyConName</span></a></span><span>
</span><span id="line-537"></span><span>    </span><span id="local-6989586621681170879"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170879"><span class="hs-identifier hs-var">u1</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#u1TyConName"><span class="hs-identifier hs-var">u1TyConName</span></a></span><span>
</span><span id="line-538"></span><span>    </span><span id="local-6989586621681170877"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170877"><span class="hs-identifier hs-var">v1</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#v1TyConName"><span class="hs-identifier hs-var">v1TyConName</span></a></span><span>
</span><span id="line-539"></span><span>    </span><span id="local-6989586621681170875"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170875"><span class="hs-identifier hs-var">plus</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#sumTyConName"><span class="hs-identifier hs-var">sumTyConName</span></a></span><span>
</span><span id="line-540"></span><span>    </span><span id="local-6989586621681170873"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170873"><span class="hs-identifier hs-var">times</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#prodTyConName"><span class="hs-identifier hs-var">prodTyConName</span></a></span><span>
</span><span id="line-541"></span><span>    </span><span id="local-6989586621681170871"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170871"><span class="hs-identifier hs-var">comp</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#compTyConName"><span class="hs-identifier hs-var">compTyConName</span></a></span><span>
</span><span id="line-542"></span><span>    </span><span id="local-6989586621681170869"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170869"><span class="hs-identifier hs-var">uAddr</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#uAddrTyConName"><span class="hs-identifier hs-var">uAddrTyConName</span></a></span><span>
</span><span id="line-543"></span><span>    </span><span id="local-6989586621681170867"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170867"><span class="hs-identifier hs-var">uChar</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#uCharTyConName"><span class="hs-identifier hs-var">uCharTyConName</span></a></span><span>
</span><span id="line-544"></span><span>    </span><span id="local-6989586621681170865"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170865"><span class="hs-identifier hs-var">uDouble</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#uDoubleTyConName"><span class="hs-identifier hs-var">uDoubleTyConName</span></a></span><span>
</span><span id="line-545"></span><span>    </span><span id="local-6989586621681170863"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170863"><span class="hs-identifier hs-var">uFloat</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#uFloatTyConName"><span class="hs-identifier hs-var">uFloatTyConName</span></a></span><span>
</span><span id="line-546"></span><span>    </span><span id="local-6989586621681170861"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170861"><span class="hs-identifier hs-var">uInt</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#uIntTyConName"><span class="hs-identifier hs-var">uIntTyConName</span></a></span><span>
</span><span id="line-547"></span><span>    </span><span id="local-6989586621681170859"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170859"><span class="hs-identifier hs-var">uWord</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupTyCon"><span class="hs-identifier hs-var">tcLookupTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#uWordTyConName"><span class="hs-identifier hs-var">uWordTyConName</span></a></span><span>
</span><span id="line-548"></span><span>
</span><span id="line-549"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681170855"><span class="annot"><span class="annottext">tcLookupPromDataCon :: Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var hs-var">tcLookupPromDataCon</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DataCon -&gt; TyCon)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) DataCon
-&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; TyCon
</span><a href="GHC.Core.DataCon.html#promoteDataCon"><span class="hs-identifier hs-var">promoteDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) DataCon
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon)
-&gt; (Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) DataCon)
-&gt; Name
-&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) DataCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupDataCon"><span class="hs-identifier hs-var">tcLookupDataCon</span></a></span><span>
</span><span id="line-550"></span><span>
</span><span id="line-551"></span><span>    </span><span id="local-6989586621681170852"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170852"><span class="hs-identifier hs-var">md</span></a></span></span><span>         </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#metaDataDataConName"><span class="hs-identifier hs-var">metaDataDataConName</span></a></span><span>
</span><span id="line-552"></span><span>    </span><span id="local-6989586621681170850"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170850"><span class="hs-identifier hs-var">mc</span></a></span></span><span>         </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#metaConsDataConName"><span class="hs-identifier hs-var">metaConsDataConName</span></a></span><span>
</span><span id="line-553"></span><span>    </span><span id="local-6989586621681170848"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170848"><span class="hs-identifier hs-var">ms</span></a></span></span><span>         </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#metaSelDataConName"><span class="hs-identifier hs-var">metaSelDataConName</span></a></span><span>
</span><span id="line-554"></span><span>    </span><span id="local-6989586621681170846"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170846"><span class="hs-identifier hs-var">pPrefix</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#prefixIDataConName"><span class="hs-identifier hs-var">prefixIDataConName</span></a></span><span>
</span><span id="line-555"></span><span>    </span><span id="local-6989586621681170844"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170844"><span class="hs-identifier hs-var">pInfix</span></a></span></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#infixIDataConName"><span class="hs-identifier hs-var">infixIDataConName</span></a></span><span>
</span><span id="line-556"></span><span>    </span><span id="local-6989586621681170842"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170842"><span class="hs-identifier hs-var">pLA</span></a></span></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#leftAssociativeDataConName"><span class="hs-identifier hs-var">leftAssociativeDataConName</span></a></span><span>
</span><span id="line-557"></span><span>    </span><span id="local-6989586621681170840"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170840"><span class="hs-identifier hs-var">pRA</span></a></span></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#rightAssociativeDataConName"><span class="hs-identifier hs-var">rightAssociativeDataConName</span></a></span><span>
</span><span id="line-558"></span><span>    </span><span id="local-6989586621681170838"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170838"><span class="hs-identifier hs-var">pNA</span></a></span></span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#notAssociativeDataConName"><span class="hs-identifier hs-var">notAssociativeDataConName</span></a></span><span>
</span><span id="line-559"></span><span>    </span><span id="local-6989586621681170836"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170836"><span class="hs-identifier hs-var">pSUpk</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#sourceUnpackDataConName"><span class="hs-identifier hs-var">sourceUnpackDataConName</span></a></span><span>
</span><span id="line-560"></span><span>    </span><span id="local-6989586621681170834"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170834"><span class="hs-identifier hs-var">pSNUpk</span></a></span></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#sourceNoUnpackDataConName"><span class="hs-identifier hs-var">sourceNoUnpackDataConName</span></a></span><span>
</span><span id="line-561"></span><span>    </span><span id="local-6989586621681170832"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170832"><span class="hs-identifier hs-var">pNSUpkness</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#noSourceUnpackednessDataConName"><span class="hs-identifier hs-var">noSourceUnpackednessDataConName</span></a></span><span>
</span><span id="line-562"></span><span>    </span><span id="local-6989586621681170830"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170830"><span class="hs-identifier hs-var">pSLzy</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#sourceLazyDataConName"><span class="hs-identifier hs-var">sourceLazyDataConName</span></a></span><span>
</span><span id="line-563"></span><span>    </span><span id="local-6989586621681170828"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170828"><span class="hs-identifier hs-var">pSStr</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#sourceStrictDataConName"><span class="hs-identifier hs-var">sourceStrictDataConName</span></a></span><span>
</span><span id="line-564"></span><span>    </span><span id="local-6989586621681170826"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170826"><span class="hs-identifier hs-var">pNSStrness</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#noSourceStrictnessDataConName"><span class="hs-identifier hs-var">noSourceStrictnessDataConName</span></a></span><span>
</span><span id="line-565"></span><span>    </span><span id="local-6989586621681170824"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170824"><span class="hs-identifier hs-var">pDLzy</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#decidedLazyDataConName"><span class="hs-identifier hs-var">decidedLazyDataConName</span></a></span><span>
</span><span id="line-566"></span><span>    </span><span id="local-6989586621681170822"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170822"><span class="hs-identifier hs-var">pDStr</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#decidedStrictDataConName"><span class="hs-identifier hs-var">decidedStrictDataConName</span></a></span><span>
</span><span id="line-567"></span><span>    </span><span id="local-6989586621681170820"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170820"><span class="hs-identifier hs-var">pDUpk</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TyCon
</span><a href="#local-6989586621681170855"><span class="hs-identifier hs-var">tcLookupPromDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#decidedUnpackDataConName"><span class="hs-identifier hs-var">decidedUnpackDataConName</span></a></span><span>
</span><span id="line-568"></span><span>
</span><span id="line-569"></span><span>    </span><span id="local-6989586621681170818"><span class="annot"><span class="annottext">FixityEnv
</span><a href="#local-6989586621681170818"><span class="hs-identifier hs-var">fix_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRn FixityEnv
</span><a href="GHC.Tc.Utils.Monad.html#getFixityEnv"><span class="hs-identifier hs-var">getFixityEnv</span></a></span><span>
</span><span id="line-570"></span><span>
</span><span id="line-571"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681170816"><span class="annot"><span class="annottext">mkSum' :: Type -&gt; Type -&gt; Type
</span><a href="#local-6989586621681170816"><span class="hs-identifier hs-var hs-var">mkSum'</span></a></span></span><span> </span><span id="local-6989586621681170815"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170815"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681170814"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170814"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170875"><span class="hs-identifier hs-var">plus</span></a></span><span>  </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170892"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170815"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170814"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-572"></span><span>        </span><span id="local-6989586621681170812"><span class="annot"><span class="annottext">mkProd :: Type -&gt; Type -&gt; Type
</span><a href="#local-6989586621681170812"><span class="hs-identifier hs-var hs-var">mkProd</span></a></span></span><span> </span><span id="local-6989586621681170811"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170811"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681170810"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170810"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170873"><span class="hs-identifier hs-var">times</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170892"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170811"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170810"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-573"></span><span>        </span><span id="local-6989586621681170809"><span class="annot"><span class="annottext">mkRec0 :: Type -&gt; Type
</span><a href="#local-6989586621681170809"><span class="hs-identifier hs-var hs-var">mkRec0</span></a></span></span><span> </span><span id="local-6989586621681170808"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170808"><span class="hs-identifier hs-var">a</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon
-&gt; TyCon
-&gt; TyCon
-&gt; TyCon
-&gt; TyCon
-&gt; TyCon
-&gt; TyCon
-&gt; Type
-&gt; Type
-&gt; Type
</span><a href="GHC.Tc.Deriv.Generics.html#mkBoxTy"><span class="hs-identifier hs-var">mkBoxTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170869"><span class="hs-identifier hs-var">uAddr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170867"><span class="hs-identifier hs-var">uChar</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170865"><span class="hs-identifier hs-var">uDouble</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170863"><span class="hs-identifier hs-var">uFloat</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170861"><span class="hs-identifier hs-var">uInt</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170859"><span class="hs-identifier hs-var">uWord</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170885"><span class="hs-identifier hs-var">rec0</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170892"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170808"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-574"></span><span>        </span><span id="local-6989586621681170806"><span class="annot"><span class="annottext">mkRec1 :: Type -&gt; Type
</span><a href="#local-6989586621681170806"><span class="hs-identifier hs-var hs-var">mkRec1</span></a></span></span><span> </span><span id="local-6989586621681170805"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170805"><span class="hs-identifier hs-var">a</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170883"><span class="hs-identifier hs-var">rec1</span></a></span><span>  </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170892"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170805"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-575"></span><span>        </span><span id="local-6989586621681170804"><span class="annot"><span class="annottext">mkPar1 :: Type
</span><a href="#local-6989586621681170804"><span class="hs-identifier hs-var hs-var">mkPar1</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span>  </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170881"><span class="hs-identifier hs-var">par1</span></a></span><span>
</span><span id="line-576"></span><span>        </span><span id="local-6989586621681170802"><span class="annot"><span class="annottext">mkD :: TyCon -&gt; Type
</span><a href="#local-6989586621681170802"><span class="hs-identifier hs-var hs-var">mkD</span></a></span></span><span>    </span><span id="local-6989586621681170801"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170801"><span class="hs-identifier hs-var">a</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170891"><span class="hs-identifier hs-var">d1</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170892"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170800"><span class="hs-identifier hs-var">metaDataTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[DataCon] -&gt; Type
</span><a href="#local-6989586621681170799"><span class="hs-identifier hs-var">sumP</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [DataCon]
</span><a href="GHC.Core.TyCon.html#tyConDataCons"><span class="hs-identifier hs-var">tyConDataCons</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170801"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-577"></span><span>        </span><span id="local-6989586621681170798"><span class="annot"><span class="annottext">mkC :: DataCon -&gt; Type
</span><a href="#local-6989586621681170798"><span class="hs-identifier hs-var hs-var">mkC</span></a></span></span><span>      </span><span id="local-6989586621681170797"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170797"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170889"><span class="hs-identifier hs-var">c1</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170892"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-578"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Type
</span><a href="#local-6989586621681170796"><span class="hs-identifier hs-var">metaConsTy</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170797"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-579"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; [HsSrcBang] -&gt; [HsImplBang] -&gt; [FieldLabel] -&gt; Type
</span><a href="#local-6989586621681170795"><span class="hs-identifier hs-var">prod</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Scaled Type -&gt; Type) -&gt; [Scaled Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">([Scaled Type] -&gt; [Type])
-&gt; (TyCon -&gt; [Scaled Type]) -&gt; TyCon -&gt; [Type]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Type] -&gt; [Scaled Type]
</span><a href="GHC.Core.DataCon.html#dataConInstOrigArgTys"><span class="hs-identifier hs-var">dataConInstOrigArgTys</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170797"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-580"></span><span>                                            </span><span class="annot"><span class="annottext">([Type] -&gt; [Scaled Type])
-&gt; (TyCon -&gt; [Type]) -&gt; TyCon -&gt; [Scaled Type]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[TyVar] -&gt; [Type]
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier hs-var">mkTyVarTys</span></a></span><span> </span><span class="annot"><span class="annottext">([TyVar] -&gt; [Type]) -&gt; (TyCon -&gt; [TyVar]) -&gt; TyCon -&gt; [Type]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [TyVar]
</span><a href="GHC.Core.TyCon.html#tyConTyVars"><span class="hs-identifier hs-var hs-var">tyConTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; [Type]) -&gt; TyCon -&gt; [Type]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170893"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-581"></span><span>                                          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; [HsSrcBang]
</span><a href="GHC.Core.DataCon.html#dataConSrcBangs"><span class="hs-identifier hs-var">dataConSrcBangs</span></a></span><span>    </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170797"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-582"></span><span>                                          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; [HsImplBang]
</span><a href="GHC.Core.DataCon.html#dataConImplBangs"><span class="hs-identifier hs-var">dataConImplBangs</span></a></span><span>   </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170797"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-583"></span><span>                                          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; [FieldLabel]
</span><a href="GHC.Core.DataCon.html#dataConFieldLabels"><span class="hs-identifier hs-var">dataConFieldLabels</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170797"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-584"></span><span>        </span><span id="local-6989586621681170789"><span class="annot"><span class="annottext">mkS :: Maybe FieldLabel
-&gt; SrcUnpackedness -&gt; SrcStrictness -&gt; HsImplBang -&gt; Type -&gt; Type
</span><a href="#local-6989586621681170789"><span class="hs-identifier hs-var hs-var">mkS</span></a></span></span><span> </span><span id="local-6989586621681170788"><span class="annot"><span class="annottext">Maybe FieldLabel
</span><a href="#local-6989586621681170788"><span class="hs-identifier hs-var">mlbl</span></a></span></span><span> </span><span id="local-6989586621681170787"><span class="annot"><span class="annottext">SrcUnpackedness
</span><a href="#local-6989586621681170787"><span class="hs-identifier hs-var">su</span></a></span></span><span> </span><span id="local-6989586621681170786"><span class="annot"><span class="annottext">SrcStrictness
</span><a href="#local-6989586621681170786"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span id="local-6989586621681170785"><span class="annot"><span class="annottext">HsImplBang
</span><a href="#local-6989586621681170785"><span class="hs-identifier hs-var">ib</span></a></span></span><span> </span><span id="local-6989586621681170784"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170784"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170887"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170892"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe FieldLabel
-&gt; SrcUnpackedness -&gt; SrcStrictness -&gt; HsImplBang -&gt; Type
</span><a href="#local-6989586621681170783"><span class="hs-identifier hs-var">metaSelTy</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe FieldLabel
</span><a href="#local-6989586621681170788"><span class="hs-identifier hs-var">mlbl</span></a></span><span> </span><span class="annot"><span class="annottext">SrcUnpackedness
</span><a href="#local-6989586621681170787"><span class="hs-identifier hs-var">su</span></a></span><span> </span><span class="annot"><span class="annottext">SrcStrictness
</span><a href="#local-6989586621681170786"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="annot"><span class="annottext">HsImplBang
</span><a href="#local-6989586621681170785"><span class="hs-identifier hs-var">ib</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170784"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-585"></span><span>
</span><span id="line-586"></span><span>        </span><span class="hs-comment">-- Sums and products are done in the same way for both Rep and Rep1</span><span>
</span><span id="line-587"></span><span>        </span><span id="local-6989586621681170799"><span class="annot"><span class="annottext">sumP :: [DataCon] -&gt; Type
</span><a href="#local-6989586621681170799"><span class="hs-identifier hs-var hs-var">sumP</span></a></span></span><span> </span><span id="local-6989586621681170782"><span class="annot"><span class="annottext">[DataCon]
</span><a href="#local-6989586621681170782"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Type -&gt; Type) -&gt; Type -&gt; [Type] -&gt; Type
forall a. (a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#foldBal"><span class="hs-identifier hs-var">foldBal</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Type
</span><a href="#local-6989586621681170816"><span class="hs-identifier hs-var">mkSum'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170877"><span class="hs-identifier hs-var">v1</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170892"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([Type] -&gt; Type) -&gt; ([DataCon] -&gt; [Type]) -&gt; [DataCon] -&gt; Type
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(DataCon -&gt; Type) -&gt; [DataCon] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Type
</span><a href="#local-6989586621681170798"><span class="hs-identifier hs-var">mkC</span></a></span><span> </span><span class="annot"><span class="annottext">([DataCon] -&gt; Type) -&gt; [DataCon] -&gt; Type
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[DataCon]
</span><a href="#local-6989586621681170782"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-588"></span><span>        </span><span class="hs-comment">-- The Bool is True if this constructor has labelled fields</span><span>
</span><span id="line-589"></span><span>        </span><span class="annot"><a href="#local-6989586621681170795"><span class="hs-identifier hs-type">prod</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.DataCon.html#HsSrcBang"><span class="hs-identifier hs-type">HsSrcBang</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.DataCon.html#HsImplBang"><span class="hs-identifier hs-type">HsImplBang</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-590"></span><span>        </span><span id="local-6989586621681170795"><span class="annot"><span class="annottext">prod :: [Type] -&gt; [HsSrcBang] -&gt; [HsImplBang] -&gt; [FieldLabel] -&gt; Type
</span><a href="#local-6989586621681170795"><span class="hs-identifier hs-var hs-var">prod</span></a></span></span><span> </span><span id="local-6989586621681170780"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170780"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681170779"><span class="annot"><span class="annottext">[HsSrcBang]
</span><a href="#local-6989586621681170779"><span class="hs-identifier hs-var">sb</span></a></span></span><span> </span><span id="local-6989586621681170778"><span class="annot"><span class="annottext">[HsImplBang]
</span><a href="#local-6989586621681170778"><span class="hs-identifier hs-var">ib</span></a></span></span><span> </span><span id="local-6989586621681170777"><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681170777"><span class="hs-identifier hs-var">fl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Type -&gt; Type) -&gt; Type -&gt; [Type] -&gt; Type
forall a. (a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#foldBal"><span class="hs-identifier hs-var">foldBal</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Type
</span><a href="#local-6989586621681170812"><span class="hs-identifier hs-var">mkProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170879"><span class="hs-identifier hs-var">u1</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170892"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-591"></span><span>                                  </span><span class="hs-special">[</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span class="hs-identifier">null</span><span> </span><span class="hs-identifier">fl</span><span> </span><span class="hs-operator">||</span><span> </span><span class="hs-identifier">lengthExceeds</span><span> </span><span class="hs-identifier">fl</span><span> </span><span class="hs-identifier">j</span><span class="hs-special">)</span><span>
</span><span id="line-592"></span><span>                                    </span><span class="annot"><span class="annottext">Type -&gt; HsSrcBang -&gt; HsImplBang -&gt; Maybe FieldLabel -&gt; Type
</span><a href="#local-6989586621681170774"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170773"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">HsSrcBang
</span><a href="#local-6989586621681170772"><span class="hs-identifier hs-var">sb'</span></a></span><span> </span><span class="annot"><span class="annottext">HsImplBang
</span><a href="#local-6989586621681170771"><span class="hs-identifier hs-var">ib'</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[FieldLabel] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681170777"><span class="hs-identifier hs-var">fl</span></a></span><span>
</span><span id="line-593"></span><span>                                                      </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Maybe FieldLabel
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-594"></span><span>                                                      </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">FieldLabel -&gt; Maybe FieldLabel
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[FieldLabel]
</span><a href="#local-6989586621681170777"><span class="hs-identifier hs-var">fl</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel] -&gt; US -&gt; FieldLabel
forall a. [a] -&gt; US -&gt; a
</span><a href="../../base/src/GHC.List.html#%21%21"><span class="hs-operator hs-var">!!</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170775"><span class="hs-identifier hs-var">j</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-595"></span><span>                                  </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681170773"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170773"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681170772"><span class="annot"><span class="annottext">HsSrcBang
</span><a href="#local-6989586621681170772"><span class="hs-identifier hs-var">sb'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681170771"><span class="annot"><span class="annottext">HsImplBang
</span><a href="#local-6989586621681170771"><span class="hs-identifier hs-var">ib'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681170775"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170775"><span class="hs-identifier hs-var">j</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Type]
-&gt; [HsSrcBang]
-&gt; [HsImplBang]
-&gt; [US]
-&gt; [(Type, HsSrcBang, HsImplBang, US)]
forall a b c d. [a] -&gt; [b] -&gt; [c] -&gt; [d] -&gt; [(a, b, c, d)]
</span><a href="../../base/src/Data.OldList.html#zip4"><span class="hs-identifier hs-var">zip4</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681170780"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[HsSrcBang]
</span><a href="#local-6989586621681170779"><span class="hs-identifier hs-var">sb</span></a></span><span> </span><span class="annot"><span class="annottext">[HsImplBang]
</span><a href="#local-6989586621681170778"><span class="hs-identifier hs-var">ib</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">US
</span><span class="hs-number">0</span></span><span class="hs-glyph">..</span><span class="hs-special">]</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-596"></span><span>
</span><span id="line-597"></span><span>        </span><span class="annot"><a href="#local-6989586621681170774"><span class="hs-identifier hs-type">arg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#HsSrcBang"><span class="hs-identifier hs-type">HsSrcBang</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#HsImplBang"><span class="hs-identifier hs-type">HsImplBang</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.FieldLabel.html#FieldLabel"><span class="hs-identifier hs-type">FieldLabel</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-598"></span><span>        </span><span id="local-6989586621681170774"><span class="annot"><span class="annottext">arg :: Type -&gt; HsSrcBang -&gt; HsImplBang -&gt; Maybe FieldLabel -&gt; Type
</span><a href="#local-6989586621681170774"><span class="hs-identifier hs-var hs-var">arg</span></a></span></span><span> </span><span id="local-6989586621681170769"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170769"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.DataCon.html#HsSrcBang"><span class="hs-identifier hs-type">HsSrcBang</span></a></span><span> </span><span class="annot"><span class="annottext">SourceText
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681170767"><span class="annot"><span class="annottext">SrcUnpackedness
</span><a href="#local-6989586621681170767"><span class="hs-identifier hs-var">su</span></a></span></span><span> </span><span id="local-6989586621681170766"><span class="annot"><span class="annottext">SrcStrictness
</span><a href="#local-6989586621681170766"><span class="hs-identifier hs-var">ss</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681170765"><span class="annot"><span class="annottext">HsImplBang
</span><a href="#local-6989586621681170765"><span class="hs-identifier hs-var">ib</span></a></span></span><span> </span><span id="local-6989586621681170764"><span class="annot"><span class="annottext">Maybe FieldLabel
</span><a href="#local-6989586621681170764"><span class="hs-identifier hs-var">fl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe FieldLabel
-&gt; SrcUnpackedness -&gt; SrcStrictness -&gt; HsImplBang -&gt; Type -&gt; Type
</span><a href="#local-6989586621681170789"><span class="hs-identifier hs-var">mkS</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe FieldLabel
</span><a href="#local-6989586621681170764"><span class="hs-identifier hs-var">fl</span></a></span><span> </span><span class="annot"><span class="annottext">SrcUnpackedness
</span><a href="#local-6989586621681170767"><span class="hs-identifier hs-var">su</span></a></span><span> </span><span class="annot"><span class="annottext">SrcStrictness
</span><a href="#local-6989586621681170766"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="annot"><span class="annottext">HsImplBang
</span><a href="#local-6989586621681170765"><span class="hs-identifier hs-var">ib</span></a></span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Type) -&gt; Type -&gt; Type
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">GenericKind_
</span><a href="#local-6989586621681170894"><span class="hs-identifier hs-var">gk_</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-599"></span><span>            </span><span class="hs-comment">-- Here we previously used Par0 if t was a type variable, but we</span><span>
</span><span id="line-600"></span><span>            </span><span class="hs-comment">-- realized that we can't always guarantee that we are wrapping-up</span><span>
</span><span id="line-601"></span><span>            </span><span class="hs-comment">-- all type variables in Par0. So we decided to stop using Par0</span><span>
</span><span id="line-602"></span><span>            </span><span class="hs-comment">-- altogether, and use Rec0 all the time.</span><span>
</span><span id="line-603"></span><span>                      </span><span class="annot"><span class="annottext">GenericKind_
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0_"><span class="hs-identifier hs-var">Gen0_</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type
</span><a href="#local-6989586621681170809"><span class="hs-identifier hs-var">mkRec0</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170769"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-604"></span><span>                      </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen1_"><span class="hs-identifier hs-type">Gen1_</span></a></span><span> </span><span id="local-6989586621681170763"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170763"><span class="hs-identifier hs-var">argVar</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; Type -&gt; Type
</span><a href="#local-6989586621681170762"><span class="hs-identifier hs-var">argPar</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170763"><span class="hs-identifier hs-var">argVar</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170769"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-605"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-606"></span><span>            </span><span class="hs-comment">-- Builds argument representation for Rep1 (more complicated due to</span><span>
</span><span id="line-607"></span><span>            </span><span class="hs-comment">-- the presence of composition).</span><span>
</span><span id="line-608"></span><span>            </span><span id="local-6989586621681170762"><span class="annot"><span class="annottext">argPar :: TyVar -&gt; Type -&gt; Type
</span><a href="#local-6989586621681170762"><span class="hs-identifier hs-var hs-var">argPar</span></a></span></span><span> </span><span id="local-6989586621681170761"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170761"><span class="hs-identifier hs-var">argVar</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; ArgTyAlg Type -&gt; Type -&gt; Type
forall a. TyVar -&gt; ArgTyAlg a -&gt; Type -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#argTyFold"><span class="hs-identifier hs-var">argTyFold</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170761"><span class="hs-identifier hs-var">argVar</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgTyAlg Type -&gt; Type -&gt; Type) -&gt; ArgTyAlg Type -&gt; Type -&gt; Type
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ArgTyAlg :: forall a.
(Type -&gt; a) -&gt; a -&gt; (Type -&gt; a) -&gt; (Type -&gt; a -&gt; a) -&gt; ArgTyAlg a
</span><a href="GHC.Tc.Deriv.Generics.html#ArgTyAlg"><span class="hs-identifier hs-type">ArgTyAlg</span></a></span><span>
</span><span id="line-609"></span><span>              </span><span class="hs-special">{</span><span class="annot"><span class="annottext">ata_rec0 :: Type -&gt; Type
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec0"><span class="hs-identifier hs-var">ata_rec0</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type
</span><a href="#local-6989586621681170809"><span class="hs-identifier hs-var">mkRec0</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ata_par1 :: Type
</span><a href="GHC.Tc.Deriv.Generics.html#ata_par1"><span class="hs-identifier hs-var">ata_par1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170804"><span class="hs-identifier hs-var">mkPar1</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-610"></span><span>               </span><span class="annot"><span class="annottext">ata_rec1 :: Type -&gt; Type
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec1"><span class="hs-identifier hs-var">ata_rec1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type
</span><a href="#local-6989586621681170806"><span class="hs-identifier hs-var">mkRec1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ata_comp :: Type -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Deriv.Generics.html#ata_comp"><span class="hs-identifier hs-var">ata_comp</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Type -&gt; Type -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Deriv.Generics.html#mkComp"><span class="hs-identifier hs-var">mkComp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170871"><span class="hs-identifier hs-var">comp</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170892"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-611"></span><span>
</span><span id="line-612"></span><span>        </span><span id="local-6989586621681170759"><span class="annot"><span class="annottext">tyConName_user :: Name
</span><a href="#local-6989586621681170759"><span class="hs-identifier hs-var hs-var">tyConName_user</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.TyCon.html#tyConFamInst_maybe"><span class="hs-identifier hs-var">tyConFamInst_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170893"><span class="hs-identifier hs-var">tycon</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-613"></span><span>                           </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681170758"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170758"><span class="hs-identifier hs-var">ptycon</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Name
</span><a href="GHC.Core.TyCon.html#tyConName"><span class="hs-identifier hs-var hs-var">tyConName</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170758"><span class="hs-identifier hs-var">ptycon</span></a></span><span>
</span><span id="line-614"></span><span>                           </span><span class="annot"><span class="annottext">Maybe (TyCon, [Type])
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Name
</span><a href="GHC.Core.TyCon.html#tyConName"><span class="hs-identifier hs-var hs-var">tyConName</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170893"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-615"></span><span>
</span><span id="line-616"></span><span>        </span><span id="local-6989586621681170757"><span class="annot"><span class="annottext">dtName :: Type
</span><a href="#local-6989586621681170757"><span class="hs-identifier hs-var hs-var">dtName</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Type
</span><a href="GHC.Core.Type.html#mkStrLitTy"><span class="hs-identifier hs-var">mkStrLitTy</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; Type) -&gt; (Name -&gt; FastString) -&gt; Name -&gt; Type
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; FastString
</span><a href="GHC.Types.Name.Occurrence.html#occNameFS"><span class="hs-identifier hs-var hs-var">occNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">(OccName -&gt; FastString) -&gt; (Name -&gt; OccName) -&gt; Name -&gt; FastString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Type) -&gt; Name -&gt; Type
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681170759"><span class="hs-identifier hs-var">tyConName_user</span></a></span><span>
</span><span id="line-617"></span><span>        </span><span id="local-6989586621681170754"><span class="annot"><span class="annottext">mdName :: Type
</span><a href="#local-6989586621681170754"><span class="hs-identifier hs-var hs-var">mdName</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Type
</span><a href="GHC.Core.Type.html#mkStrLitTy"><span class="hs-identifier hs-var">mkStrLitTy</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; Type) -&gt; (TyCon -&gt; FastString) -&gt; TyCon -&gt; Type
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; FastString
</span><a href="GHC.Unit.Module.Name.html#moduleNameFS"><span class="hs-identifier hs-var">moduleNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">(ModuleName -&gt; FastString)
-&gt; (TyCon -&gt; ModuleName) -&gt; TyCon -&gt; FastString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span>
</span><span id="line-618"></span><span>                </span><span class="annot"><span class="annottext">(Module -&gt; ModuleName) -&gt; (TyCon -&gt; Module) -&gt; TyCon -&gt; ModuleName
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Module
Name -&gt; Module
</span><a href="GHC.Types.Name.html#nameModule"><span class="hs-identifier hs-var">nameModule</span></a></span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Module) -&gt; (TyCon -&gt; Name) -&gt; TyCon -&gt; Module
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Name
</span><a href="GHC.Core.TyCon.html#tyConName"><span class="hs-identifier hs-var hs-var">tyConName</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Type) -&gt; TyCon -&gt; Type
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170893"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-619"></span><span>        </span><span id="local-6989586621681170752"><span class="annot"><span class="annottext">pkgName :: Type
</span><a href="#local-6989586621681170752"><span class="hs-identifier hs-var hs-var">pkgName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Type
</span><a href="GHC.Core.Type.html#mkStrLitTy"><span class="hs-identifier hs-var">mkStrLitTy</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; Type) -&gt; (TyCon -&gt; FastString) -&gt; TyCon -&gt; Type
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Unit -&gt; FastString
</span><a href="GHC.Unit.Types.html#unitFS"><span class="hs-identifier hs-var">unitFS</span></a></span><span> </span><span class="annot"><span class="annottext">(Unit -&gt; FastString) -&gt; (TyCon -&gt; Unit) -&gt; TyCon -&gt; FastString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Module -&gt; Unit
forall unit. GenModule unit -&gt; unit
</span><a href="GHC.Unit.Types.html#moduleUnit"><span class="hs-identifier hs-var hs-var">moduleUnit</span></a></span><span>
</span><span id="line-620"></span><span>                </span><span class="annot"><span class="annottext">(Module -&gt; Unit) -&gt; (TyCon -&gt; Module) -&gt; TyCon -&gt; Unit
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Module
Name -&gt; Module
</span><a href="GHC.Types.Name.html#nameModule"><span class="hs-identifier hs-var">nameModule</span></a></span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Module) -&gt; (TyCon -&gt; Name) -&gt; TyCon -&gt; Module
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Name
</span><a href="GHC.Core.TyCon.html#tyConName"><span class="hs-identifier hs-var hs-var">tyConName</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Type) -&gt; TyCon -&gt; Type
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170893"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-621"></span><span>        </span><span id="local-6989586621681170751"><span class="annot"><span class="annottext">isNT :: Type
</span><a href="#local-6989586621681170751"><span class="hs-identifier hs-var hs-var">isNT</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Type) -&gt; TyCon -&gt; Type
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isNewTyCon"><span class="hs-identifier hs-var">isNewTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170893"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-622"></span><span>                              </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#promotedTrueDataCon"><span class="hs-identifier hs-var">promotedTrueDataCon</span></a></span><span>
</span><span id="line-623"></span><span>                              </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#promotedFalseDataCon"><span class="hs-identifier hs-var">promotedFalseDataCon</span></a></span><span>
</span><span id="line-624"></span><span>
</span><span id="line-625"></span><span>        </span><span id="local-6989586621681170747"><span class="annot"><span class="annottext">ctName :: DataCon -&gt; Type
</span><a href="#local-6989586621681170747"><span class="hs-identifier hs-var hs-var">ctName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Type
</span><a href="GHC.Core.Type.html#mkStrLitTy"><span class="hs-identifier hs-var">mkStrLitTy</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; Type) -&gt; (DataCon -&gt; FastString) -&gt; DataCon -&gt; Type
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">OccName -&gt; FastString
</span><a href="GHC.Types.Name.Occurrence.html#occNameFS"><span class="hs-identifier hs-var hs-var">occNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">(OccName -&gt; FastString)
-&gt; (DataCon -&gt; OccName) -&gt; DataCon -&gt; FastString
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">(Name -&gt; OccName) -&gt; (DataCon -&gt; Name) -&gt; DataCon -&gt; OccName
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Name
</span><a href="GHC.Core.DataCon.html#dataConName"><span class="hs-identifier hs-var">dataConName</span></a></span><span>
</span><span id="line-626"></span><span>        </span><span id="local-6989586621681170745"><span class="annot"><span class="annottext">ctFix :: DataCon -&gt; Type
</span><a href="#local-6989586621681170745"><span class="hs-identifier hs-var hs-var">ctFix</span></a></span></span><span> </span><span id="local-6989586621681170744"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170744"><span class="hs-identifier hs-var">c</span></a></span></span><span>
</span><span id="line-627"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Bool
</span><a href="GHC.Core.DataCon.html#dataConIsInfix"><span class="hs-identifier hs-var">dataConIsInfix</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170744"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-628"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">FixityEnv -&gt; Name -&gt; Fixity
</span><a href="GHC.Driver.Types.html#lookupFixity"><span class="hs-identifier hs-var">lookupFixity</span></a></span><span> </span><span class="annot"><span class="annottext">FixityEnv
</span><a href="#local-6989586621681170818"><span class="hs-identifier hs-var">fix_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; Name
</span><a href="GHC.Core.DataCon.html#dataConName"><span class="hs-identifier hs-var">dataConName</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170744"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-629"></span><span>                   </span><span class="annot"><a href="GHC.Types.Basic.html#Fixity"><span class="hs-identifier hs-type">Fixity</span></a></span><span> </span><span class="annot"><span class="annottext">SourceText
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681170740"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170740"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="annottext">FixityDirection
</span><a href="GHC.Types.Basic.html#InfixL"><span class="hs-identifier hs-var">InfixL</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">US -&gt; TyCon -&gt; Type
</span><a href="#local-6989586621681170738"><span class="hs-identifier hs-var">buildFix</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170740"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170842"><span class="hs-identifier hs-var">pLA</span></a></span><span>
</span><span id="line-630"></span><span>                   </span><span class="annot"><a href="GHC.Types.Basic.html#Fixity"><span class="hs-identifier hs-type">Fixity</span></a></span><span> </span><span class="annot"><span class="annottext">SourceText
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681170737"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170737"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="annottext">FixityDirection
</span><a href="GHC.Types.Basic.html#InfixR"><span class="hs-identifier hs-var">InfixR</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">US -&gt; TyCon -&gt; Type
</span><a href="#local-6989586621681170738"><span class="hs-identifier hs-var">buildFix</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170737"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170840"><span class="hs-identifier hs-var">pRA</span></a></span><span>
</span><span id="line-631"></span><span>                   </span><span class="annot"><a href="GHC.Types.Basic.html#Fixity"><span class="hs-identifier hs-type">Fixity</span></a></span><span> </span><span class="annot"><span class="annottext">SourceText
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681170735"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170735"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="annottext">FixityDirection
</span><a href="GHC.Types.Basic.html#InfixN"><span class="hs-identifier hs-var">InfixN</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">US -&gt; TyCon -&gt; Type
</span><a href="#local-6989586621681170738"><span class="hs-identifier hs-var">buildFix</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170735"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170838"><span class="hs-identifier hs-var">pNA</span></a></span><span>
</span><span id="line-632"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170846"><span class="hs-identifier hs-var">pPrefix</span></a></span><span>
</span><span id="line-633"></span><span>        </span><span id="local-6989586621681170738"><span class="annot"><span class="annottext">buildFix :: US -&gt; TyCon -&gt; Type
</span><a href="#local-6989586621681170738"><span class="hs-identifier hs-var hs-var">buildFix</span></a></span></span><span> </span><span id="local-6989586621681170733"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170733"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621681170732"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170732"><span class="hs-identifier hs-var">assoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170844"><span class="hs-identifier hs-var">pInfix</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170732"><span class="hs-identifier hs-var">assoc</span></a></span><span>
</span><span id="line-634"></span><span>                                             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Type
</span><a href="GHC.Core.Type.html#mkNumLitTy"><span class="hs-identifier hs-var">mkNumLitTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">US -&gt; Integer
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170733"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-635"></span><span>
</span><span id="line-636"></span><span>        </span><span id="local-6989586621681170730"><span class="annot"><span class="annottext">isRec :: DataCon -&gt; Type
</span><a href="#local-6989586621681170730"><span class="hs-identifier hs-var hs-var">isRec</span></a></span></span><span> </span><span id="local-6989586621681170729"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170729"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Type) -&gt; TyCon -&gt; Type
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [FieldLabel]
</span><a href="GHC.Core.DataCon.html#dataConFieldLabels"><span class="hs-identifier hs-var">dataConFieldLabels</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170729"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">[FieldLabel] -&gt; US -&gt; Bool
forall a. [a] -&gt; US -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthExceeds"><span class="hs-operator hs-var">`lengthExceeds`</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">0</span></span><span>
</span><span id="line-637"></span><span>                              </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#promotedTrueDataCon"><span class="hs-identifier hs-var">promotedTrueDataCon</span></a></span><span>
</span><span id="line-638"></span><span>                              </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#promotedFalseDataCon"><span class="hs-identifier hs-var">promotedFalseDataCon</span></a></span><span>
</span><span id="line-639"></span><span>
</span><span id="line-640"></span><span>        </span><span id="local-6989586621681170728"><span class="annot"><span class="annottext">selName :: FieldLbl a -&gt; Type
</span><a href="#local-6989586621681170728"><span class="hs-identifier hs-var hs-var">selName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Type
</span><a href="GHC.Core.Type.html#mkStrLitTy"><span class="hs-identifier hs-var">mkStrLitTy</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; Type)
-&gt; (FieldLbl a -&gt; FastString) -&gt; FieldLbl a -&gt; Type
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLbl a -&gt; FastString
forall a. FieldLbl a -&gt; FastString
</span><a href="GHC.Types.FieldLabel.html#flLabel"><span class="hs-identifier hs-var hs-var">flLabel</span></a></span><span>
</span><span id="line-641"></span><span>
</span><span id="line-642"></span><span>        </span><span id="local-6989586621681170726"><span class="annot"><span class="annottext">mbSel :: Maybe (FieldLbl a) -&gt; Type
</span><a href="#local-6989586621681170726"><span class="hs-identifier hs-var hs-var">mbSel</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe (FieldLbl a)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#promotedNothingDataCon"><span class="hs-identifier hs-var">promotedNothingDataCon</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#typeSymbolKind"><span class="hs-identifier hs-var">typeSymbolKind</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-643"></span><span>        </span><span class="annot"><a href="#local-6989586621681170726"><span class="hs-identifier hs-var">mbSel</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681170723"><span class="annot"><span class="annottext">FieldLbl a
</span><a href="#local-6989586621681170723"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="GHC.Builtin.Types.html#promotedJustDataCon"><span class="hs-identifier hs-var">promotedJustDataCon</span></a></span><span>
</span><span id="line-644"></span><span>                                    </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#typeSymbolKind"><span class="hs-identifier hs-var">typeSymbolKind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FieldLbl a -&gt; Type
forall {a}. FieldLbl a -&gt; Type
</span><a href="#local-6989586621681170728"><span class="hs-identifier hs-var">selName</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLbl a
</span><a href="#local-6989586621681170723"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-645"></span><span>
</span><span id="line-646"></span><span>        </span><span id="local-6989586621681170800"><span class="annot"><span class="annottext">metaDataTy :: Type
</span><a href="#local-6989586621681170800"><span class="hs-identifier hs-var hs-var">metaDataTy</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170852"><span class="hs-identifier hs-var">md</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170757"><span class="hs-identifier hs-var">dtName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170754"><span class="hs-identifier hs-var">mdName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170752"><span class="hs-identifier hs-var">pkgName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170751"><span class="hs-identifier hs-var">isNT</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-647"></span><span>        </span><span id="local-6989586621681170796"><span class="annot"><span class="annottext">metaConsTy :: DataCon -&gt; Type
</span><a href="#local-6989586621681170796"><span class="hs-identifier hs-var hs-var">metaConsTy</span></a></span></span><span> </span><span id="local-6989586621681170721"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170721"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170850"><span class="hs-identifier hs-var">mc</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">DataCon -&gt; Type
</span><a href="#local-6989586621681170747"><span class="hs-identifier hs-var">ctName</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170721"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Type
</span><a href="#local-6989586621681170745"><span class="hs-identifier hs-var">ctFix</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170721"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Type
</span><a href="#local-6989586621681170730"><span class="hs-identifier hs-var">isRec</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170721"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-648"></span><span>        </span><span id="local-6989586621681170783"><span class="annot"><span class="annottext">metaSelTy :: Maybe FieldLabel
-&gt; SrcUnpackedness -&gt; SrcStrictness -&gt; HsImplBang -&gt; Type
</span><a href="#local-6989586621681170783"><span class="hs-identifier hs-var hs-var">metaSelTy</span></a></span></span><span> </span><span id="local-6989586621681170720"><span class="annot"><span class="annottext">Maybe FieldLabel
</span><a href="#local-6989586621681170720"><span class="hs-identifier hs-var">mlbl</span></a></span></span><span> </span><span id="local-6989586621681170719"><span class="annot"><span class="annottext">SrcUnpackedness
</span><a href="#local-6989586621681170719"><span class="hs-identifier hs-var">su</span></a></span></span><span> </span><span id="local-6989586621681170718"><span class="annot"><span class="annottext">SrcStrictness
</span><a href="#local-6989586621681170718"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span id="local-6989586621681170717"><span class="annot"><span class="annottext">HsImplBang
</span><a href="#local-6989586621681170717"><span class="hs-identifier hs-var">ib</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-649"></span><span>            </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170848"><span class="hs-identifier hs-var">ms</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Maybe FieldLabel -&gt; Type
forall {a}. Maybe (FieldLbl a) -&gt; Type
</span><a href="#local-6989586621681170726"><span class="hs-identifier hs-var">mbSel</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe FieldLabel
</span><a href="#local-6989586621681170720"><span class="hs-identifier hs-var">mlbl</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170716"><span class="hs-identifier hs-var">pSUpkness</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170715"><span class="hs-identifier hs-var">pSStrness</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170714"><span class="hs-identifier hs-var">pDStrness</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-650"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-651"></span><span>            </span><span id="local-6989586621681170716"><span class="annot"><span class="annottext">pSUpkness :: Type
</span><a href="#local-6989586621681170716"><span class="hs-identifier hs-var hs-var">pSUpkness</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Type) -&gt; TyCon -&gt; Type
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">SrcUnpackedness
</span><a href="#local-6989586621681170719"><span class="hs-identifier hs-var">su</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-652"></span><span>                                         </span><span class="annot"><span class="annottext">SrcUnpackedness
</span><a href="GHC.Core.DataCon.html#SrcUnpack"><span class="hs-identifier hs-var">SrcUnpack</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170836"><span class="hs-identifier hs-var">pSUpk</span></a></span><span>
</span><span id="line-653"></span><span>                                         </span><span class="annot"><span class="annottext">SrcUnpackedness
</span><a href="GHC.Core.DataCon.html#SrcNoUnpack"><span class="hs-identifier hs-var">SrcNoUnpack</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170834"><span class="hs-identifier hs-var">pSNUpk</span></a></span><span>
</span><span id="line-654"></span><span>                                         </span><span class="annot"><span class="annottext">SrcUnpackedness
</span><a href="GHC.Core.DataCon.html#NoSrcUnpack"><span class="hs-identifier hs-var">NoSrcUnpack</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170832"><span class="hs-identifier hs-var">pNSUpkness</span></a></span><span>
</span><span id="line-655"></span><span>
</span><span id="line-656"></span><span>            </span><span id="local-6989586621681170715"><span class="annot"><span class="annottext">pSStrness :: Type
</span><a href="#local-6989586621681170715"><span class="hs-identifier hs-var hs-var">pSStrness</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Type) -&gt; TyCon -&gt; Type
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">SrcStrictness
</span><a href="#local-6989586621681170718"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-657"></span><span>                                         </span><span class="annot"><span class="annottext">SrcStrictness
</span><a href="GHC.Core.DataCon.html#SrcLazy"><span class="hs-identifier hs-var">SrcLazy</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170830"><span class="hs-identifier hs-var">pSLzy</span></a></span><span>
</span><span id="line-658"></span><span>                                         </span><span class="annot"><span class="annottext">SrcStrictness
</span><a href="GHC.Core.DataCon.html#SrcStrict"><span class="hs-identifier hs-var">SrcStrict</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170828"><span class="hs-identifier hs-var">pSStr</span></a></span><span>
</span><span id="line-659"></span><span>                                         </span><span class="annot"><span class="annottext">SrcStrictness
</span><a href="GHC.Core.DataCon.html#NoSrcStrict"><span class="hs-identifier hs-var">NoSrcStrict</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170826"><span class="hs-identifier hs-var">pNSStrness</span></a></span><span>
</span><span id="line-660"></span><span>
</span><span id="line-661"></span><span>            </span><span id="local-6989586621681170714"><span class="annot"><span class="annottext">pDStrness :: Type
</span><a href="#local-6989586621681170714"><span class="hs-identifier hs-var hs-var">pDStrness</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">(TyCon -&gt; Type) -&gt; TyCon -&gt; Type
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HsImplBang
</span><a href="#local-6989586621681170717"><span class="hs-identifier hs-var">ib</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-662"></span><span>                                         </span><span class="annot"><span class="annottext">HsImplBang
</span><a href="GHC.Core.DataCon.html#HsLazy"><span class="hs-identifier hs-var">HsLazy</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170824"><span class="hs-identifier hs-var">pDLzy</span></a></span><span>
</span><span id="line-663"></span><span>                                         </span><span class="annot"><span class="annottext">HsImplBang
</span><a href="GHC.Core.DataCon.html#HsStrict"><span class="hs-identifier hs-var">HsStrict</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170822"><span class="hs-identifier hs-var">pDStr</span></a></span><span>
</span><span id="line-664"></span><span>                                         </span><span class="annot"><a href="GHC.Core.DataCon.html#HsUnpack"><span class="hs-identifier hs-type">HsUnpack</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170820"><span class="hs-identifier hs-var">pDUpk</span></a></span><span>
</span><span id="line-665"></span><span>
</span><span id="line-666"></span><span>    </span><span class="annot"><span class="annottext">Type -&gt; TcM Type
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="#local-6989586621681170802"><span class="hs-identifier hs-var">mkD</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170893"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-667"></span><span>
</span><span id="line-668"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mkComp"><span class="hs-identifier hs-type">mkComp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-669"></span><span id="mkComp"><span class="annot"><span class="annottext">mkComp :: TyCon -&gt; Type -&gt; Type -&gt; Type -&gt; Type
</span><a href="GHC.Tc.Deriv.Generics.html#mkComp"><span class="hs-identifier hs-var hs-var">mkComp</span></a></span></span><span> </span><span id="local-6989586621681170704"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170704"><span class="hs-identifier hs-var">comp</span></a></span></span><span> </span><span id="local-6989586621681170703"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170703"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621681170702"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170702"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621681170701"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170701"><span class="hs-identifier hs-var">g</span></a></span></span><span>
</span><span id="line-670"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681170700"><span class="hs-identifier hs-var">k1_first</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170704"><span class="hs-identifier hs-var">comp</span></a></span><span>  </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170703"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#liftedTypeKind"><span class="hs-identifier hs-var">liftedTypeKind</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170702"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170701"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-671"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170704"><span class="hs-identifier hs-var">comp</span></a></span><span>  </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#liftedTypeKind"><span class="hs-identifier hs-var">liftedTypeKind</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170703"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170702"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170701"><span class="hs-identifier hs-var">g</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-672"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-673"></span><span>    </span><span class="hs-comment">-- Which of these is the case?</span><span>
</span><span id="line-674"></span><span>    </span><span class="hs-comment">--     newtype (:.:) {k1} {k2} (f :: k2-&gt;*) (g :: k1-&gt;k2) (p :: k1) = ...</span><span>
</span><span id="line-675"></span><span>    </span><span class="hs-comment">-- or  newtype (:.:) {k2} {k1} (f :: k2-&gt;*) (g :: k1-&gt;k2) (p :: k1) = ...</span><span>
</span><span id="line-676"></span><span>    </span><span class="hs-comment">-- We want to instantiate with k1=k, and k2=*</span><span>
</span><span id="line-677"></span><span>    </span><span class="hs-comment">--    Reason for k2=*: see Note [Handling kinds in a Rep instance]</span><span>
</span><span id="line-678"></span><span>    </span><span class="hs-comment">-- But we need to know which way round!</span><span>
</span><span id="line-679"></span><span>    </span><span id="local-6989586621681170700"><span class="annot"><span class="annottext">k1_first :: Bool
</span><a href="#local-6989586621681170700"><span class="hs-identifier hs-var hs-var">k1_first</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170699"><span class="hs-identifier hs-var">k_first</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; TyVar -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170698"><span class="hs-identifier hs-var">p_kind_var</span></a></span><span>
</span><span id="line-680"></span><span>    </span><span class="hs-special">[</span><span id="local-6989586621681170699"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170699"><span class="hs-identifier hs-var">k_first</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">TyVar
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">TyVar
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">TyVar
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span id="local-6989586621681170697"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170697"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [TyVar]
</span><a href="GHC.Core.TyCon.html#tyConTyVars"><span class="hs-identifier hs-var hs-var">tyConTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170704"><span class="hs-identifier hs-var">comp</span></a></span><span>
</span><span id="line-681"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681170698"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170698"><span class="hs-identifier hs-var">p_kind_var</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe TyVar
</span><a href="GHC.Core.Type.html#getTyVar_maybe"><span class="hs-identifier hs-var">getTyVar_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyVar -&gt; Type
</span><a href="GHC.Types.Var.html#tyVarKind"><span class="hs-identifier hs-var">tyVarKind</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170697"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-682"></span><span>
</span><span id="line-683"></span><span class="hs-comment">-- Given the TyCons for each URec-related type synonym, check to see if the</span><span>
</span><span id="line-684"></span><span class="hs-comment">-- given type is an unlifted type that generics understands. If so, return</span><span>
</span><span id="line-685"></span><span class="hs-comment">-- its representation type. Otherwise, return Rec0.</span><span>
</span><span id="line-686"></span><span class="hs-comment">-- See Note [Generics and unlifted types]</span><span>
</span><span id="line-687"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mkBoxTy"><span class="hs-identifier hs-type">mkBoxTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-comment">-- UAddr</span><span>
</span><span id="line-688"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-comment">-- UChar</span><span>
</span><span id="line-689"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-comment">-- UDouble</span><span>
</span><span id="line-690"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-comment">-- UFloat</span><span>
</span><span id="line-691"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-comment">-- UInt</span><span>
</span><span id="line-692"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-comment">-- UWord</span><span>
</span><span id="line-693"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-comment">-- Rec0</span><span>
</span><span id="line-694"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Kind"><span class="hs-identifier hs-type">Kind</span></a></span><span>  </span><span class="hs-comment">-- What to instantiate Rec0's kind variable with</span><span>
</span><span id="line-695"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-696"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span>
</span><span id="line-697"></span><span id="mkBoxTy"><span class="annot"><span class="annottext">mkBoxTy :: TyCon
-&gt; TyCon
-&gt; TyCon
-&gt; TyCon
-&gt; TyCon
-&gt; TyCon
-&gt; TyCon
-&gt; Type
-&gt; Type
-&gt; Type
</span><a href="GHC.Tc.Deriv.Generics.html#mkBoxTy"><span class="hs-identifier hs-var hs-var">mkBoxTy</span></a></span></span><span> </span><span id="local-6989586621681170696"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170696"><span class="hs-identifier hs-var">uAddr</span></a></span></span><span> </span><span id="local-6989586621681170695"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170695"><span class="hs-identifier hs-var">uChar</span></a></span></span><span> </span><span id="local-6989586621681170694"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170694"><span class="hs-identifier hs-var">uDouble</span></a></span></span><span> </span><span id="local-6989586621681170693"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170693"><span class="hs-identifier hs-var">uFloat</span></a></span></span><span> </span><span id="local-6989586621681170692"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170692"><span class="hs-identifier hs-var">uInt</span></a></span></span><span> </span><span id="local-6989586621681170691"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170691"><span class="hs-identifier hs-var">uWord</span></a></span></span><span> </span><span id="local-6989586621681170690"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170690"><span class="hs-identifier hs-var">rec0</span></a></span></span><span> </span><span id="local-6989586621681170689"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170689"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621681170688"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170688"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-698"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170688"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#addrPrimTy"><span class="hs-identifier hs-var">addrPrimTy</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170696"><span class="hs-identifier hs-var">uAddr</span></a></span><span>   </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170689"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-699"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170688"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#charPrimTy"><span class="hs-identifier hs-var">charPrimTy</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170695"><span class="hs-identifier hs-var">uChar</span></a></span><span>   </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170689"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-700"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170688"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#doublePrimTy"><span class="hs-identifier hs-var">doublePrimTy</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170694"><span class="hs-identifier hs-var">uDouble</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170689"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-701"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170688"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#floatPrimTy"><span class="hs-identifier hs-var">floatPrimTy</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170693"><span class="hs-identifier hs-var">uFloat</span></a></span><span>  </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170689"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-702"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170688"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#intPrimTy"><span class="hs-identifier hs-var">intPrimTy</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170692"><span class="hs-identifier hs-var">uInt</span></a></span><span>    </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170689"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-703"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170688"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#wordPrimTy"><span class="hs-identifier hs-var">wordPrimTy</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170691"><span class="hs-identifier hs-var">uWord</span></a></span><span>   </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170689"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-704"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681170690"><span class="hs-identifier hs-var">rec0</span></a></span><span>    </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170689"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170688"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-705"></span><span>
</span><span id="line-706"></span><span class="hs-comment">--------------------------------------------------------------------------------</span><span>
</span><span id="line-707"></span><span class="hs-comment">-- Dealing with sums</span><span>
</span><span id="line-708"></span><span class="hs-comment">--------------------------------------------------------------------------------</span><span>
</span><span id="line-709"></span><span>
</span><span id="line-710"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mkSum"><span class="hs-identifier hs-type">mkSum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind_"><span class="hs-identifier hs-type">GenericKind_</span></a></span><span> </span><span class="hs-comment">-- Generic or Generic1?</span><span>
</span><span id="line-711"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#US"><span class="hs-identifier hs-type">US</span></a></span><span>          </span><span class="hs-comment">-- Base for generating unique names</span><span>
</span><span id="line-712"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span class="hs-special">]</span><span>   </span><span class="hs-comment">-- The data constructors</span><span>
</span><span id="line-713"></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Alt"><span class="hs-identifier hs-type">Alt</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- Alternatives for the T-&gt;Trep &quot;from&quot; function</span><span>
</span><span id="line-714"></span><span>          </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Alt"><span class="hs-identifier hs-type">Alt</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>     </span><span class="hs-comment">-- Alternatives for the Trep-&gt;T &quot;to&quot; function</span><span>
</span><span id="line-715"></span><span>
</span><span id="line-716"></span><span class="hs-comment">-- Datatype without any constructors</span><span>
</span><span id="line-717"></span><span id="mkSum"><span class="annot"><span class="annottext">mkSum :: GenericKind_ -&gt; US -&gt; [DataCon] -&gt; ([Alt], [Alt])
</span><a href="GHC.Tc.Deriv.Generics.html#mkSum"><span class="hs-identifier hs-var hs-var">mkSum</span></a></span></span><span> </span><span class="annot"><span class="annottext">GenericKind_
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><span class="annottext">(Located (Pat GhcPs), LHsExpr GhcPs)
Alt
</span><a href="#local-6989586621681170680"><span class="hs-identifier hs-var">from_alt</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">(Located (Pat GhcPs), LHsExpr GhcPs)
Alt
</span><a href="#local-6989586621681170679"><span class="hs-identifier hs-var">to_alt</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-718"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-719"></span><span>    </span><span id="local-6989586621681170680"><span class="annot"><span class="annottext">from_alt :: (Located (Pat GhcPs), LHsExpr GhcPs)
</span><a href="#local-6989586621681170680"><span class="hs-identifier hs-var hs-var">from_alt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located (Pat GhcPs)
LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_Pat"><span class="hs-identifier hs-var">x_Pat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; [LMatch GhcPs (LHsExpr GhcPs)] -&gt; LHsExpr GhcPs
</span><a href="GHC.Hs.Utils.html#nlHsCase"><span class="hs-identifier hs-var">nlHsCase</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_Expr"><span class="hs-identifier hs-var">x_Expr</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-720"></span><span>    </span><span id="local-6989586621681170679"><span class="annot"><span class="annottext">to_alt :: (Located (Pat GhcPs), LHsExpr GhcPs)
</span><a href="#local-6989586621681170679"><span class="hs-identifier hs-var hs-var">to_alt</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located (Pat GhcPs)
LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_Pat"><span class="hs-identifier hs-var">x_Pat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; [LMatch GhcPs (LHsExpr GhcPs)] -&gt; LHsExpr GhcPs
</span><a href="GHC.Hs.Utils.html#nlHsCase"><span class="hs-identifier hs-var">nlHsCase</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_Expr"><span class="hs-identifier hs-var">x_Expr</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-721"></span><span>               </span><span class="hs-comment">-- These M1s are meta-information for the datatype</span><span>
</span><span id="line-722"></span><span>
</span><span id="line-723"></span><span class="hs-comment">-- Datatype with at least one constructor</span><span>
</span><span id="line-724"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mkSum"><span class="hs-identifier hs-var">mkSum</span></a></span><span> </span><span id="local-6989586621681170678"><span class="annot"><span class="annottext">GenericKind_
</span><a href="#local-6989586621681170678"><span class="hs-identifier hs-var">gk_</span></a></span></span><span> </span><span id="local-6989586621681170677"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170677"><span class="hs-identifier hs-var">us</span></a></span></span><span> </span><span id="local-6989586621681170676"><span class="annot"><span class="annottext">[DataCon]
</span><a href="#local-6989586621681170676"><span class="hs-identifier hs-var">datacons</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-725"></span><span>  </span><span class="hs-comment">-- switch the payload of gk_ to be datacon-centric instead of tycon-centric</span><span>
</span><span id="line-726"></span><span> </span><span class="annot"><span class="annottext">[((Located (Pat GhcPs), LHsExpr GhcPs),
  (Located (Pat GhcPs), LHsExpr GhcPs))]
-&gt; ([(Located (Pat GhcPs), LHsExpr GhcPs)],
    [(Located (Pat GhcPs), LHsExpr GhcPs)])
forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier hs-var">unzip</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">GenericKind_DC -&gt; US -&gt; US -&gt; US -&gt; DataCon -&gt; (Alt, Alt)
</span><a href="GHC.Tc.Deriv.Generics.html#mk1Sum"><span class="hs-identifier hs-var">mk1Sum</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenericKind_ -&gt; DataCon -&gt; GenericKind_DC
</span><a href="GHC.Tc.Deriv.Generics.html#gk2gkDC"><span class="hs-identifier hs-var">gk2gkDC</span></a></span><span> </span><span class="annot"><span class="annottext">GenericKind_
</span><a href="#local-6989586621681170678"><span class="hs-identifier hs-var">gk_</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170673"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170677"><span class="hs-identifier hs-var">us</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170672"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[DataCon] -&gt; US
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; US
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[DataCon]
</span><a href="#local-6989586621681170676"><span class="hs-identifier hs-var">datacons</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170673"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-727"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681170673"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170673"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681170672"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170672"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[DataCon] -&gt; [US] -&gt; [(DataCon, US)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="annot"><span class="annottext">[DataCon]
</span><a href="#local-6989586621681170676"><span class="hs-identifier hs-var">datacons</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">US
</span><span class="hs-number">1</span></span><span class="hs-glyph">..</span><span class="hs-special">]</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-728"></span><span>
</span><span id="line-729"></span><span class="hs-comment">-- Build the sum for a particular constructor</span><span>
</span><span id="line-730"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mk1Sum"><span class="hs-identifier hs-type">mk1Sum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind_DC"><span class="hs-identifier hs-type">GenericKind_DC</span></a></span><span> </span><span class="hs-comment">-- Generic or Generic1?</span><span>
</span><span id="line-731"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#US"><span class="hs-identifier hs-type">US</span></a></span><span>        </span><span class="hs-comment">-- Base for generating unique names</span><span>
</span><span id="line-732"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>       </span><span class="hs-comment">-- The index of this constructor</span><span>
</span><span id="line-733"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>       </span><span class="hs-comment">-- Total number of constructors</span><span>
</span><span id="line-734"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>   </span><span class="hs-comment">-- The data constructor</span><span>
</span><span id="line-735"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Alt"><span class="hs-identifier hs-type">Alt</span></a></span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- Alternative for the T-&gt;Trep &quot;from&quot; function</span><span>
</span><span id="line-736"></span><span>           </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Alt"><span class="hs-identifier hs-type">Alt</span></a></span><span class="hs-special">)</span><span>     </span><span class="hs-comment">-- Alternative for the Trep-&gt;T &quot;to&quot; function</span><span>
</span><span id="line-737"></span><span id="mk1Sum"><span class="annot"><span class="annottext">mk1Sum :: GenericKind_DC -&gt; US -&gt; US -&gt; US -&gt; DataCon -&gt; (Alt, Alt)
</span><a href="GHC.Tc.Deriv.Generics.html#mk1Sum"><span class="hs-identifier hs-var hs-var">mk1Sum</span></a></span></span><span> </span><span id="local-6989586621681170670"><span class="annot"><span class="annottext">GenericKind_DC
</span><a href="#local-6989586621681170670"><span class="hs-identifier hs-var">gk_</span></a></span></span><span> </span><span id="local-6989586621681170669"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170669"><span class="hs-identifier hs-var">us</span></a></span></span><span> </span><span id="local-6989586621681170668"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170668"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621681170667"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170667"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621681170666"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170666"><span class="hs-identifier hs-var">datacon</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Located (Pat GhcPs), LHsExpr GhcPs)
Alt
</span><a href="#local-6989586621681170665"><span class="hs-identifier hs-var">from_alt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Located (Pat GhcPs), LHsExpr GhcPs)
Alt
</span><a href="#local-6989586621681170664"><span class="hs-identifier hs-var">to_alt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-738"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-739"></span><span>    </span><span id="local-6989586621681170663"><span class="annot"><span class="annottext">gk :: GenericKind
</span><a href="#local-6989586621681170663"><span class="hs-identifier hs-var hs-var">gk</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenericKind_DC -&gt; GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#forgetArgVar"><span class="hs-identifier hs-var">forgetArgVar</span></a></span><span> </span><span class="annot"><span class="annottext">GenericKind_DC
</span><a href="#local-6989586621681170670"><span class="hs-identifier hs-var">gk_</span></a></span><span>
</span><span id="line-740"></span><span>
</span><span id="line-741"></span><span>    </span><span class="hs-comment">-- Existentials already excluded</span><span>
</span><span id="line-742"></span><span>    </span><span id="local-6989586621681170662"><span class="annot"><span class="annottext">argTys :: [Scaled Type]
</span><a href="#local-6989586621681170662"><span class="hs-identifier hs-var hs-var">argTys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Scaled Type]
</span><a href="GHC.Core.DataCon.html#dataConOrigArgTys"><span class="hs-identifier hs-var">dataConOrigArgTys</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170666"><span class="hs-identifier hs-var">datacon</span></a></span><span>
</span><span id="line-743"></span><span>    </span><span id="local-6989586621681170661"><span class="annot"><span class="annottext">n_args :: US
</span><a href="#local-6989586621681170661"><span class="hs-identifier hs-var hs-var">n_args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; US
</span><a href="GHC.Core.DataCon.html#dataConSourceArity"><span class="hs-identifier hs-var">dataConSourceArity</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170666"><span class="hs-identifier hs-var">datacon</span></a></span><span>
</span><span id="line-744"></span><span>
</span><span id="line-745"></span><span>    </span><span id="local-6989586621681170659"><span class="annot"><span class="annottext">datacon_varTys :: [(RdrName, Type)]
</span><a href="#local-6989586621681170659"><span class="hs-identifier hs-var hs-var">datacon_varTys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[RdrName] -&gt; [Type] -&gt; [(RdrName, Type)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(US -&gt; RdrName) -&gt; [US] -&gt; [RdrName]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">US -&gt; RdrName
</span><a href="GHC.Tc.Deriv.Generics.html#mkGenericLocal"><span class="hs-identifier hs-var">mkGenericLocal</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170669"><span class="hs-identifier hs-var">us</span></a></span><span> </span><span class="hs-glyph">..</span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170669"><span class="hs-identifier hs-var">us</span></a></span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170661"><span class="hs-identifier hs-var">n_args</span></a></span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">US
</span><span class="hs-number">1</span></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Scaled Type -&gt; Type) -&gt; [Scaled Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621681170662"><span class="hs-identifier hs-var">argTys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-746"></span><span>    </span><span id="local-6989586621681170656"><span class="annot"><span class="annottext">datacon_vars :: [RdrName]
</span><a href="#local-6989586621681170656"><span class="hs-identifier hs-var hs-var">datacon_vars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((RdrName, Type) -&gt; RdrName) -&gt; [(RdrName, Type)] -&gt; [RdrName]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName, Type) -&gt; RdrName
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(RdrName, Type)]
</span><a href="#local-6989586621681170659"><span class="hs-identifier hs-var">datacon_varTys</span></a></span><span>
</span><span id="line-747"></span><span>
</span><span id="line-748"></span><span>    </span><span id="local-6989586621681170655"><span class="annot"><span class="annottext">datacon_rdr :: RdrName
</span><a href="#local-6989586621681170655"><span class="hs-identifier hs-var hs-var">datacon_rdr</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; RdrName
forall thing. NamedThing thing =&gt; thing -&gt; RdrName
</span><a href="GHC.Types.Name.Reader.html#getRdrName"><span class="hs-identifier hs-var">getRdrName</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681170666"><span class="hs-identifier hs-var">datacon</span></a></span><span>
</span><span id="line-749"></span><span>
</span><span id="line-750"></span><span>    </span><span id="local-6989586621681170665"><span class="annot"><span class="annottext">from_alt :: (Located (Pat GhcPs), LHsExpr GhcPs)
</span><a href="#local-6989586621681170665"><span class="hs-identifier hs-var hs-var">from_alt</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName -&gt; [RdrName] -&gt; LPat GhcPs
</span><a href="GHC.Hs.Utils.html#nlConVarPat"><span class="hs-identifier hs-var">nlConVarPat</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681170655"><span class="hs-identifier hs-var">datacon_rdr</span></a></span><span> </span><span class="annot"><span class="annottext">[RdrName]
</span><a href="#local-6989586621681170656"><span class="hs-identifier hs-var">datacon_vars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170652"><span class="hs-identifier hs-var">from_alt_rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-751"></span><span>    </span><span id="local-6989586621681170652"><span class="annot"><span class="annottext">from_alt_rhs :: LHsExpr GhcPs
</span><a href="#local-6989586621681170652"><span class="hs-identifier hs-var hs-var">from_alt_rhs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#genLR_E"><span class="hs-identifier hs-var">genLR_E</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170668"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170667"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenericKind_DC -&gt; [(RdrName, Type)] -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkProd_E"><span class="hs-identifier hs-var">mkProd_E</span></a></span><span> </span><span class="annot"><span class="annottext">GenericKind_DC
</span><a href="#local-6989586621681170670"><span class="hs-identifier hs-var">gk_</span></a></span><span> </span><span class="annot"><span class="annottext">[(RdrName, Type)]
</span><a href="#local-6989586621681170659"><span class="hs-identifier hs-var">datacon_varTys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-752"></span><span>
</span><span id="line-753"></span><span>    </span><span id="local-6989586621681170664"><span class="annot"><span class="annottext">to_alt :: (Located (Pat GhcPs), LHsExpr GhcPs)
</span><a href="#local-6989586621681170664"><span class="hs-identifier hs-var hs-var">to_alt</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; LPat GhcPs -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#genLR_P"><span class="hs-identifier hs-var">genLR_P</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170668"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170667"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenericKind -&gt; [(RdrName, Type)] -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkProd_P"><span class="hs-identifier hs-var">mkProd_P</span></a></span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681170663"><span class="hs-identifier hs-var">gk</span></a></span><span> </span><span class="annot"><span class="annottext">[(RdrName, Type)]
</span><a href="#local-6989586621681170659"><span class="hs-identifier hs-var">datacon_varTys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-754"></span><span>                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170647"><span class="hs-identifier hs-var">to_alt_rhs</span></a></span><span>
</span><span id="line-755"></span><span>                 </span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- These M1s are meta-information for the datatype</span><span>
</span><span id="line-756"></span><span>    </span><span id="local-6989586621681170647"><span class="annot"><span class="annottext">to_alt_rhs :: LHsExpr GhcPs
</span><a href="#local-6989586621681170647"><span class="hs-identifier hs-var hs-var">to_alt_rhs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">GenericKind_DC
</span><a href="#local-6989586621681170670"><span class="hs-identifier hs-var">gk_</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-757"></span><span>      </span><span class="annot"><span class="annottext">GenericKind_DC
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0_DC"><span class="hs-identifier hs-var">Gen0_DC</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; [IdP GhcPs] -&gt; LHsExpr GhcPs
forall (id :: Pass).
IdP (GhcPass id) -&gt; [IdP (GhcPass id)] -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVarApps"><span class="hs-identifier hs-var">nlHsVarApps</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="#local-6989586621681170655"><span class="hs-identifier hs-var">datacon_rdr</span></a></span><span> </span><span class="annot"><span class="annottext">[RdrName]
[IdP GhcPs]
</span><a href="#local-6989586621681170656"><span class="hs-identifier hs-var">datacon_vars</span></a></span><span>
</span><span id="line-758"></span><span>      </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen1_DC"><span class="hs-identifier hs-type">Gen1_DC</span></a></span><span> </span><span id="local-6989586621681170645"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170645"><span class="hs-identifier hs-var">argVar</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; [LHsExpr GhcPs] -&gt; LHsExpr GhcPs
forall (id :: Pass).
IsPass id =&gt;
IdP (GhcPass id) -&gt; [LHsExpr (GhcPass id)] -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApps"><span class="hs-identifier hs-var">nlHsApps</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="#local-6989586621681170655"><span class="hs-identifier hs-var">datacon_rdr</span></a></span><span> </span><span class="annot"><span class="annottext">([LHsExpr GhcPs] -&gt; LHsExpr GhcPs)
-&gt; [LHsExpr GhcPs] -&gt; LHsExpr GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">((RdrName, Type) -&gt; LHsExpr GhcPs)
-&gt; [(RdrName, Type)] -&gt; [LHsExpr GhcPs]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName, Type) -&gt; LHsExpr GhcPs
</span><a href="#local-6989586621681170643"><span class="hs-identifier hs-var">argTo</span></a></span><span> </span><span class="annot"><span class="annottext">[(RdrName, Type)]
</span><a href="#local-6989586621681170659"><span class="hs-identifier hs-var">datacon_varTys</span></a></span><span>
</span><span id="line-759"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-760"></span><span>          </span><span id="local-6989586621681170643"><span class="annot"><span class="annottext">argTo :: (RdrName, Type) -&gt; LHsExpr GhcPs
</span><a href="#local-6989586621681170643"><span class="hs-identifier hs-var hs-var">argTo</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681170642"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681170642"><span class="hs-identifier hs-var">var</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681170641"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170641"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; LHsExpr GhcPs
</span><a href="#local-6989586621681170640"><span class="hs-identifier hs-var">converter</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170641"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="#local-6989586621681170642"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-761"></span><span>            </span><span id="local-6989586621681170640"><span class="annot"><span class="annottext">converter :: Type -&gt; LHsExpr GhcPs
</span><a href="#local-6989586621681170640"><span class="hs-identifier hs-var hs-var">converter</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; ArgTyAlg (LHsExpr GhcPs) -&gt; Type -&gt; LHsExpr GhcPs
forall a. TyVar -&gt; ArgTyAlg a -&gt; Type -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#argTyFold"><span class="hs-identifier hs-var">argTyFold</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170645"><span class="hs-identifier hs-var">argVar</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgTyAlg (LHsExpr GhcPs) -&gt; Type -&gt; LHsExpr GhcPs)
-&gt; ArgTyAlg (LHsExpr GhcPs) -&gt; Type -&gt; LHsExpr GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ArgTyAlg :: forall a.
(Type -&gt; a) -&gt; a -&gt; (Type -&gt; a) -&gt; (Type -&gt; a -&gt; a) -&gt; ArgTyAlg a
</span><a href="GHC.Tc.Deriv.Generics.html#ArgTyAlg"><span class="hs-identifier hs-type">ArgTyAlg</span></a></span><span>
</span><span id="line-762"></span><span>              </span><span class="hs-special">{</span><span class="annot"><span class="annottext">ata_rec0 :: Type -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec0"><span class="hs-identifier hs-var">ata_rec0</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName -&gt; LHsExpr GhcPs)
-&gt; (Type -&gt; RdrName) -&gt; Type -&gt; LHsExpr GhcPs
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; RdrName
</span><a href="GHC.Tc.Deriv.Generics.html#unboxRepRDR"><span class="hs-identifier hs-var">unboxRepRDR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-763"></span><span>               </span><span class="annot"><span class="annottext">ata_par1 :: LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#ata_par1"><span class="hs-identifier hs-var">ata_par1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#unPar1_RDR"><span class="hs-identifier hs-var">unPar1_RDR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-764"></span><span>               </span><span class="annot"><span class="annottext">ata_rec1 :: Type -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec1"><span class="hs-identifier hs-var">ata_rec1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; Type -&gt; LHsExpr GhcPs
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr GhcPs -&gt; Type -&gt; LHsExpr GhcPs)
-&gt; LHsExpr GhcPs -&gt; Type -&gt; LHsExpr GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#unRec1_RDR"><span class="hs-identifier hs-var">unRec1_RDR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-765"></span><span>               </span><span class="annot"><span class="annottext">ata_comp :: Type -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#ata_comp"><span class="hs-identifier hs-var">ata_comp</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681170634"><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170634"><span class="hs-identifier hs-var">cnv</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#fmap_RDR"><span class="hs-identifier hs-var">fmap_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170634"><span class="hs-identifier hs-var">cnv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-766"></span><span>                                    </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#nlHsCompose"><span class="hs-operator hs-var">`nlHsCompose`</span></a></span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#unComp1_RDR"><span class="hs-identifier hs-var">unComp1_RDR</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-767"></span><span>
</span><span id="line-768"></span><span>
</span><span id="line-769"></span><span class="hs-comment">-- Generates the L1/R1 sum pattern</span><span>
</span><span id="line-770"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#genLR_P"><span class="hs-identifier hs-type">genLR_P</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-771"></span><span id="genLR_P"><span class="annot"><span class="annottext">genLR_P :: US -&gt; US -&gt; LPat GhcPs -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#genLR_P"><span class="hs-identifier hs-var hs-var">genLR_P</span></a></span></span><span> </span><span id="local-6989586621681170630"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170630"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621681170629"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170629"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621681170628"><span class="annot"><span class="annottext">LPat GhcPs
</span><a href="#local-6989586621681170628"><span class="hs-identifier hs-var">p</span></a></span></span><span>
</span><span id="line-772"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170629"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">0</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Located (Pat GhcPs)
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;impossible&quot;</span></span><span>
</span><span id="line-773"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170629"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">1</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat GhcPs
</span><a href="#local-6989586621681170628"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-774"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170630"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170629"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">2</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LPat GhcPs
forall (name :: Pass). LPat (GhcPass name) -&gt; LPat (GhcPass name)
</span><a href="GHC.Hs.Utils.html#nlParPat"><span class="hs-identifier hs-var">nlParPat</span></a></span><span> </span><span class="annot"><span class="annottext">(LPat GhcPs -&gt; LPat GhcPs) -&gt; LPat GhcPs -&gt; LPat GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; [LPat GhcPs] -&gt; LPat GhcPs
</span><a href="GHC.Hs.Utils.html#nlConPat"><span class="hs-identifier hs-var">nlConPat</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#l1DataCon_RDR"><span class="hs-identifier hs-var">l1DataCon_RDR</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">US -&gt; US -&gt; LPat GhcPs -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#genLR_P"><span class="hs-identifier hs-var">genLR_P</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170630"><span class="hs-identifier hs-var">i</span></a></span><span>     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170629"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LPat GhcPs
</span><a href="#local-6989586621681170628"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-775"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LPat GhcPs
forall (name :: Pass). LPat (GhcPass name) -&gt; LPat (GhcPass name)
</span><a href="GHC.Hs.Utils.html#nlParPat"><span class="hs-identifier hs-var">nlParPat</span></a></span><span> </span><span class="annot"><span class="annottext">(LPat GhcPs -&gt; LPat GhcPs) -&gt; LPat GhcPs -&gt; LPat GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; [LPat GhcPs] -&gt; LPat GhcPs
</span><a href="GHC.Hs.Utils.html#nlConPat"><span class="hs-identifier hs-var">nlConPat</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#r1DataCon_RDR"><span class="hs-identifier hs-var">r1DataCon_RDR</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">US -&gt; US -&gt; LPat GhcPs -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#genLR_P"><span class="hs-identifier hs-var">genLR_P</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170630"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170620"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170629"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170620"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>     </span><span class="annot"><span class="annottext">LPat GhcPs
</span><a href="#local-6989586621681170628"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-776"></span><span>                     </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681170620"><span class="annot"><span class="annottext">m :: US
</span><a href="#local-6989586621681170620"><span class="hs-identifier hs-var hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170629"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">2</span></span><span>
</span><span id="line-777"></span><span>
</span><span id="line-778"></span><span class="hs-comment">-- Generates the L1/R1 sum expression</span><span>
</span><span id="line-779"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#genLR_E"><span class="hs-identifier hs-type">genLR_E</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-780"></span><span id="genLR_E"><span class="annot"><span class="annottext">genLR_E :: US -&gt; US -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#genLR_E"><span class="hs-identifier hs-var hs-var">genLR_E</span></a></span></span><span> </span><span id="local-6989586621681170619"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170619"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span id="local-6989586621681170618"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170618"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621681170617"><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170617"><span class="hs-identifier hs-var">e</span></a></span></span><span>
</span><span id="line-781"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170618"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">0</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; LHsExpr GhcPs
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;impossible&quot;</span></span><span>
</span><span id="line-782"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170618"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">1</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170617"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-783"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170619"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;=</span></span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170618"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">2</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#l1DataCon_RDR"><span class="hs-identifier hs-var">l1DataCon_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span>
</span><span id="line-784"></span><span>                                            </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsPar"><span class="hs-identifier hs-var">nlHsPar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">US -&gt; US -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#genLR_E"><span class="hs-identifier hs-var">genLR_E</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170619"><span class="hs-identifier hs-var">i</span></a></span><span>     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170618"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170617"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-785"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#r1DataCon_RDR"><span class="hs-identifier hs-var">r1DataCon_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span>
</span><span id="line-786"></span><span>                                            </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsPar"><span class="hs-identifier hs-var">nlHsPar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">US -&gt; US -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#genLR_E"><span class="hs-identifier hs-var">genLR_E</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170619"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170616"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170618"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170616"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>     </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170617"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-787"></span><span>                     </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681170616"><span class="annot"><span class="annottext">m :: US
</span><a href="#local-6989586621681170616"><span class="hs-identifier hs-var hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170618"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">2</span></span><span>
</span><span id="line-788"></span><span>
</span><span id="line-789"></span><span class="hs-comment">--------------------------------------------------------------------------------</span><span>
</span><span id="line-790"></span><span class="hs-comment">-- Dealing with products</span><span>
</span><span id="line-791"></span><span class="hs-comment">--------------------------------------------------------------------------------</span><span>
</span><span id="line-792"></span><span>
</span><span id="line-793"></span><span class="hs-comment">-- Build a product expression</span><span>
</span><span id="line-794"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mkProd_E"><span class="hs-identifier hs-type">mkProd_E</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind_DC"><span class="hs-identifier hs-type">GenericKind_DC</span></a></span><span>    </span><span class="hs-comment">-- Generic or Generic1?</span><span>
</span><span id="line-795"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-796"></span><span>                       </span><span class="hs-comment">-- List of variables matched on the lhs and their types</span><span>
</span><span id="line-797"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>   </span><span class="hs-comment">-- Resulting product expression</span><span>
</span><span id="line-798"></span><span id="mkProd_E"><span class="annot"><span class="annottext">mkProd_E :: GenericKind_DC -&gt; [(RdrName, Type)] -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkProd_E"><span class="hs-identifier hs-var hs-var">mkProd_E</span></a></span></span><span> </span><span id="local-6989586621681170615"><span class="annot"><span class="annottext">GenericKind_DC
</span><a href="#local-6989586621681170615"><span class="hs-identifier hs-var">gk_</span></a></span></span><span> </span><span id="local-6989586621681170614"><span class="annot"><span class="annottext">[(RdrName, Type)]
</span><a href="#local-6989586621681170614"><span class="hs-identifier hs-var">varTys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkM1_E"><span class="hs-identifier hs-var">mkM1_E</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs)
-&gt; LHsExpr GhcPs -&gt; [LHsExpr GhcPs] -&gt; LHsExpr GhcPs
forall a. (a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#foldBal"><span class="hs-identifier hs-var">foldBal</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall {id :: Pass}.
(IsPass id, IdGhcP id ~ RdrName) =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="#local-6989586621681170613"><span class="hs-identifier hs-var">prod</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#u1DataCon_RDR"><span class="hs-identifier hs-var">u1DataCon_RDR</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LHsExpr GhcPs]
</span><a href="#local-6989586621681170611"><span class="hs-identifier hs-var">appVars</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-799"></span><span>                      </span><span class="hs-comment">-- These M1s are meta-information for the constructor</span><span>
</span><span id="line-800"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-801"></span><span>    </span><span id="local-6989586621681170611"><span class="annot"><span class="annottext">appVars :: [LHsExpr GhcPs]
</span><a href="#local-6989586621681170611"><span class="hs-identifier hs-var hs-var">appVars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((RdrName, Type) -&gt; LHsExpr GhcPs)
-&gt; [(RdrName, Type)] -&gt; [LHsExpr GhcPs]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenericKind_DC -&gt; (RdrName, Type) -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#wrapArg_E"><span class="hs-identifier hs-var">wrapArg_E</span></a></span><span> </span><span class="annot"><span class="annottext">GenericKind_DC
</span><a href="#local-6989586621681170615"><span class="hs-identifier hs-var">gk_</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(RdrName, Type)]
</span><a href="#local-6989586621681170614"><span class="hs-identifier hs-var">varTys</span></a></span><span>
</span><span id="line-802"></span><span>    </span><span id="local-6989586621681170613"><span class="annot"><span class="annottext">prod :: LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="#local-6989586621681170613"><span class="hs-identifier hs-var hs-var">prod</span></a></span></span><span> </span><span id="local-6989586621681170603"><span class="annot"><span class="annottext">LHsExpr (GhcPass id)
</span><a href="#local-6989586621681170603"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681170602"><span class="annot"><span class="annottext">LHsExpr (GhcPass id)
</span><a href="#local-6989586621681170602"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RdrName
IdP (GhcPass id)
</span><a href="GHC.Builtin.Names.html#prodDataCon_RDR"><span class="hs-identifier hs-var">prodDataCon_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">IdP (GhcPass id) -&gt; [LHsExpr (GhcPass id)] -&gt; LHsExpr (GhcPass id)
forall (id :: Pass).
IsPass id =&gt;
IdP (GhcPass id) -&gt; [LHsExpr (GhcPass id)] -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApps"><span class="hs-operator hs-var">`nlHsApps`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LHsExpr (GhcPass id)
</span><a href="#local-6989586621681170603"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">LHsExpr (GhcPass id)
</span><a href="#local-6989586621681170602"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-803"></span><span>
</span><span id="line-804"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#wrapArg_E"><span class="hs-identifier hs-type">wrapArg_E</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind_DC"><span class="hs-identifier hs-type">GenericKind_DC</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-805"></span><span id="wrapArg_E"><span class="annot"><span class="annottext">wrapArg_E :: GenericKind_DC -&gt; (RdrName, Type) -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#wrapArg_E"><span class="hs-identifier hs-var hs-var">wrapArg_E</span></a></span></span><span> </span><span class="annot"><span class="annottext">GenericKind_DC
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0_DC"><span class="hs-identifier hs-var">Gen0_DC</span></a></span><span>          </span><span class="hs-special">(</span><span id="local-6989586621681170600"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681170600"><span class="hs-identifier hs-var">var</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681170599"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170599"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkM1_E"><span class="hs-identifier hs-var">mkM1_E</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr GhcPs -&gt; LHsExpr GhcPs) -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-806"></span><span>                            </span><span class="annot"><span class="annottext">Type -&gt; RdrName
</span><a href="GHC.Tc.Deriv.Generics.html#boxRepRDR"><span class="hs-identifier hs-var">boxRepRDR</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170599"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; [IdP GhcPs] -&gt; LHsExpr GhcPs
forall (id :: Pass).
IdP (GhcPass id) -&gt; [IdP (GhcPass id)] -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVarApps"><span class="hs-operator hs-var">`nlHsVarApps`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="#local-6989586621681170600"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-807"></span><span>                         </span><span class="hs-comment">-- This M1 is meta-information for the selector</span><span>
</span><span id="line-808"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#wrapArg_E"><span class="hs-identifier hs-var">wrapArg_E</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#Gen1_DC"><span class="hs-identifier hs-type">Gen1_DC</span></a></span><span> </span><span id="local-6989586621681170597"><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170597"><span class="hs-identifier hs-var">argVar</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681170596"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681170596"><span class="hs-identifier hs-var">var</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681170595"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170595"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkM1_E"><span class="hs-identifier hs-var">mkM1_E</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr GhcPs -&gt; LHsExpr GhcPs) -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-809"></span><span>                            </span><span class="annot"><span class="annottext">Type -&gt; LHsExpr GhcPs
</span><a href="#local-6989586621681170594"><span class="hs-identifier hs-var">converter</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170595"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="#local-6989586621681170596"><span class="hs-identifier hs-var">var</span></a></span><span>
</span><span id="line-810"></span><span>                         </span><span class="hs-comment">-- This M1 is meta-information for the selector</span><span>
</span><span id="line-811"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681170594"><span class="annot"><span class="annottext">converter :: Type -&gt; LHsExpr GhcPs
</span><a href="#local-6989586621681170594"><span class="hs-identifier hs-var hs-var">converter</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyVar -&gt; ArgTyAlg (LHsExpr GhcPs) -&gt; Type -&gt; LHsExpr GhcPs
forall a. TyVar -&gt; ArgTyAlg a -&gt; Type -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#argTyFold"><span class="hs-identifier hs-var">argTyFold</span></a></span><span> </span><span class="annot"><span class="annottext">TyVar
</span><a href="#local-6989586621681170597"><span class="hs-identifier hs-var">argVar</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgTyAlg (LHsExpr GhcPs) -&gt; Type -&gt; LHsExpr GhcPs)
-&gt; ArgTyAlg (LHsExpr GhcPs) -&gt; Type -&gt; LHsExpr GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ArgTyAlg :: forall a.
(Type -&gt; a) -&gt; a -&gt; (Type -&gt; a) -&gt; (Type -&gt; a -&gt; a) -&gt; ArgTyAlg a
</span><a href="GHC.Tc.Deriv.Generics.html#ArgTyAlg"><span class="hs-identifier hs-type">ArgTyAlg</span></a></span><span>
</span><span id="line-812"></span><span>          </span><span class="hs-special">{</span><span class="annot"><span class="annottext">ata_rec0 :: Type -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec0"><span class="hs-identifier hs-var">ata_rec0</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName -&gt; LHsExpr GhcPs)
-&gt; (Type -&gt; RdrName) -&gt; Type -&gt; LHsExpr GhcPs
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; RdrName
</span><a href="GHC.Tc.Deriv.Generics.html#boxRepRDR"><span class="hs-identifier hs-var">boxRepRDR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-813"></span><span>           </span><span class="annot"><span class="annottext">ata_par1 :: LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#ata_par1"><span class="hs-identifier hs-var">ata_par1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#par1DataCon_RDR"><span class="hs-identifier hs-var">par1DataCon_RDR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-814"></span><span>           </span><span class="annot"><span class="annottext">ata_rec1 :: Type -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#ata_rec1"><span class="hs-identifier hs-var">ata_rec1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; Type -&gt; LHsExpr GhcPs
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsExpr GhcPs -&gt; Type -&gt; LHsExpr GhcPs)
-&gt; LHsExpr GhcPs -&gt; Type -&gt; LHsExpr GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#rec1DataCon_RDR"><span class="hs-identifier hs-var">rec1DataCon_RDR</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-815"></span><span>           </span><span class="annot"><span class="annottext">ata_comp :: Type -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#ata_comp"><span class="hs-identifier hs-var">ata_comp</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681170591"><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170591"><span class="hs-identifier hs-var">cnv</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#comp1DataCon_RDR"><span class="hs-identifier hs-var">comp1DataCon_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#nlHsCompose"><span class="hs-operator hs-var">`nlHsCompose`</span></a></span><span>
</span><span id="line-816"></span><span>                                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#fmap_RDR"><span class="hs-identifier hs-var">fmap_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170591"><span class="hs-identifier hs-var">cnv</span></a></span><span class="hs-special">)</span><span class="hs-special">}</span><span>
</span><span id="line-817"></span><span>
</span><span id="line-818"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#boxRepRDR"><span class="hs-identifier hs-type">boxRepRDR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span>
</span><span id="line-819"></span><span id="boxRepRDR"><span class="annot"><span class="annottext">boxRepRDR :: Type -&gt; RdrName
</span><a href="GHC.Tc.Deriv.Generics.html#boxRepRDR"><span class="hs-identifier hs-var hs-var">boxRepRDR</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RdrName
-&gt; ((RdrName, RdrName) -&gt; RdrName)
-&gt; Maybe (RdrName, RdrName)
-&gt; RdrName
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#k1DataCon_RDR"><span class="hs-identifier hs-var">k1DataCon_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName, RdrName) -&gt; RdrName
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (RdrName, RdrName) -&gt; RdrName)
-&gt; (Type -&gt; Maybe (RdrName, RdrName)) -&gt; Type -&gt; RdrName
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (RdrName, RdrName)
</span><a href="GHC.Tc.Deriv.Generics.html#unboxedRepRDRs"><span class="hs-identifier hs-var">unboxedRepRDRs</span></a></span><span>
</span><span id="line-820"></span><span>
</span><span id="line-821"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#unboxRepRDR"><span class="hs-identifier hs-type">unboxRepRDR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span>
</span><span id="line-822"></span><span id="unboxRepRDR"><span class="annot"><span class="annottext">unboxRepRDR :: Type -&gt; RdrName
</span><a href="GHC.Tc.Deriv.Generics.html#unboxRepRDR"><span class="hs-identifier hs-var hs-var">unboxRepRDR</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RdrName
-&gt; ((RdrName, RdrName) -&gt; RdrName)
-&gt; Maybe (RdrName, RdrName)
-&gt; RdrName
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#unK1_RDR"><span class="hs-identifier hs-var">unK1_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">(RdrName, RdrName) -&gt; RdrName
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (RdrName, RdrName) -&gt; RdrName)
-&gt; (Type -&gt; Maybe (RdrName, RdrName)) -&gt; Type -&gt; RdrName
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (RdrName, RdrName)
</span><a href="GHC.Tc.Deriv.Generics.html#unboxedRepRDRs"><span class="hs-identifier hs-var">unboxedRepRDRs</span></a></span><span>
</span><span id="line-823"></span><span>
</span><span id="line-824"></span><span class="hs-comment">-- Retrieve the RDRs associated with each URec data family instance</span><span>
</span><span id="line-825"></span><span class="hs-comment">-- constructor. See Note [Generics and unlifted types]</span><span>
</span><span id="line-826"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#unboxedRepRDRs"><span class="hs-identifier hs-type">unboxedRepRDRs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-827"></span><span id="unboxedRepRDRs"><span class="annot"><span class="annottext">unboxedRepRDRs :: Type -&gt; Maybe (RdrName, RdrName)
</span><a href="GHC.Tc.Deriv.Generics.html#unboxedRepRDRs"><span class="hs-identifier hs-var hs-var">unboxedRepRDRs</span></a></span></span><span> </span><span id="local-6989586621681170587"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170587"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-828"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170587"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#addrPrimTy"><span class="hs-identifier hs-var">addrPrimTy</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(RdrName, RdrName) -&gt; Maybe (RdrName, RdrName)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uAddrDataCon_RDR"><span class="hs-identifier hs-var">uAddrDataCon_RDR</span></a></span><span class="hs-special">,</span><span>   </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uAddrHash_RDR"><span class="hs-identifier hs-var">uAddrHash_RDR</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-829"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170587"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#charPrimTy"><span class="hs-identifier hs-var">charPrimTy</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(RdrName, RdrName) -&gt; Maybe (RdrName, RdrName)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uCharDataCon_RDR"><span class="hs-identifier hs-var">uCharDataCon_RDR</span></a></span><span class="hs-special">,</span><span>   </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uCharHash_RDR"><span class="hs-identifier hs-var">uCharHash_RDR</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-830"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170587"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#doublePrimTy"><span class="hs-identifier hs-var">doublePrimTy</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(RdrName, RdrName) -&gt; Maybe (RdrName, RdrName)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uDoubleDataCon_RDR"><span class="hs-identifier hs-var">uDoubleDataCon_RDR</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uDoubleHash_RDR"><span class="hs-identifier hs-var">uDoubleHash_RDR</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-831"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170587"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#floatPrimTy"><span class="hs-identifier hs-var">floatPrimTy</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(RdrName, RdrName) -&gt; Maybe (RdrName, RdrName)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uFloatDataCon_RDR"><span class="hs-identifier hs-var">uFloatDataCon_RDR</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uFloatHash_RDR"><span class="hs-identifier hs-var">uFloatHash_RDR</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-832"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170587"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#intPrimTy"><span class="hs-identifier hs-var">intPrimTy</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(RdrName, RdrName) -&gt; Maybe (RdrName, RdrName)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uIntDataCon_RDR"><span class="hs-identifier hs-var">uIntDataCon_RDR</span></a></span><span class="hs-special">,</span><span>    </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uIntHash_RDR"><span class="hs-identifier hs-var">uIntHash_RDR</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-833"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170587"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.Prim.html#wordPrimTy"><span class="hs-identifier hs-var">wordPrimTy</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(RdrName, RdrName) -&gt; Maybe (RdrName, RdrName)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uWordDataCon_RDR"><span class="hs-identifier hs-var">uWordDataCon_RDR</span></a></span><span class="hs-special">,</span><span>   </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#uWordHash_RDR"><span class="hs-identifier hs-var">uWordHash_RDR</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-834"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (RdrName, RdrName)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-835"></span><span>
</span><span id="line-836"></span><span class="hs-comment">-- Build a product pattern</span><span>
</span><span id="line-837"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mkProd_P"><span class="hs-identifier hs-type">mkProd_P</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind"><span class="hs-identifier hs-type">GenericKind</span></a></span><span>       </span><span class="hs-comment">-- Gen0 or Gen1</span><span>
</span><span id="line-838"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- List of variables to match,</span><span>
</span><span id="line-839"></span><span>                              </span><span class="hs-comment">--   along with their types</span><span>
</span><span id="line-840"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>      </span><span class="hs-comment">-- Resulting product pattern</span><span>
</span><span id="line-841"></span><span id="mkProd_P"><span class="annot"><span class="annottext">mkProd_P :: GenericKind -&gt; [(RdrName, Type)] -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkProd_P"><span class="hs-identifier hs-var hs-var">mkProd_P</span></a></span></span><span> </span><span id="local-6989586621681170574"><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681170574"><span class="hs-identifier hs-var">gk</span></a></span></span><span> </span><span id="local-6989586621681170573"><span class="annot"><span class="annottext">[(RdrName, Type)]
</span><a href="#local-6989586621681170573"><span class="hs-identifier hs-var">varTys</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkM1_P"><span class="hs-identifier hs-var">mkM1_P</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Located (Pat GhcPs) -&gt; Located (Pat GhcPs) -&gt; Located (Pat GhcPs))
-&gt; Located (Pat GhcPs)
-&gt; [Located (Pat GhcPs)]
-&gt; Located (Pat GhcPs)
forall a. (a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#foldBal"><span class="hs-identifier hs-var">foldBal</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat GhcPs) -&gt; Located (Pat GhcPs) -&gt; Located (Pat GhcPs)
</span><a href="#local-6989586621681170572"><span class="hs-identifier hs-var">prod</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RdrName -&gt; LPat GhcPs
</span><a href="GHC.Hs.Utils.html#nlNullaryConPat"><span class="hs-identifier hs-var">nlNullaryConPat</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#u1DataCon_RDR"><span class="hs-identifier hs-var">u1DataCon_RDR</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Located (Pat GhcPs)]
</span><a href="#local-6989586621681170570"><span class="hs-identifier hs-var">appVars</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-842"></span><span>                     </span><span class="hs-comment">-- These M1s are meta-information for the constructor</span><span>
</span><span id="line-843"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-844"></span><span>    </span><span id="local-6989586621681170570"><span class="annot"><span class="annottext">appVars :: [Located (Pat GhcPs)]
</span><a href="#local-6989586621681170570"><span class="hs-identifier hs-var hs-var">appVars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(RdrName -&gt; Type -&gt; Located (Pat GhcPs))
-&gt; [(RdrName, Type)] -&gt; [Located (Pat GhcPs)]
forall a b c. (a -&gt; b -&gt; c) -&gt; [(a, b)] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#unzipWith"><span class="hs-identifier hs-var">unzipWith</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenericKind -&gt; RdrName -&gt; Type -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#wrapArg_P"><span class="hs-identifier hs-var">wrapArg_P</span></a></span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="#local-6989586621681170574"><span class="hs-identifier hs-var">gk</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(RdrName, Type)]
</span><a href="#local-6989586621681170573"><span class="hs-identifier hs-var">varTys</span></a></span><span>
</span><span id="line-845"></span><span>    </span><span id="local-6989586621681170572"><span class="annot"><span class="annottext">prod :: Located (Pat GhcPs) -&gt; Located (Pat GhcPs) -&gt; LPat GhcPs
</span><a href="#local-6989586621681170572"><span class="hs-identifier hs-var hs-var">prod</span></a></span></span><span> </span><span id="local-6989586621681170567"><span class="annot"><span class="annottext">Located (Pat GhcPs)
</span><a href="#local-6989586621681170567"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621681170566"><span class="annot"><span class="annottext">Located (Pat GhcPs)
</span><a href="#local-6989586621681170566"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LPat GhcPs
forall (name :: Pass). LPat (GhcPass name) -&gt; LPat (GhcPass name)
</span><a href="GHC.Hs.Utils.html#nlParPat"><span class="hs-identifier hs-var">nlParPat</span></a></span><span> </span><span class="annot"><span class="annottext">(LPat GhcPs -&gt; LPat GhcPs) -&gt; LPat GhcPs -&gt; LPat GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#prodDataCon_RDR"><span class="hs-identifier hs-var">prodDataCon_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; [LPat GhcPs] -&gt; LPat GhcPs
</span><a href="GHC.Hs.Utils.html#nlConPat"><span class="hs-operator hs-var">`nlConPat`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Located (Pat GhcPs)
LPat GhcPs
</span><a href="#local-6989586621681170567"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Located (Pat GhcPs)
LPat GhcPs
</span><a href="#local-6989586621681170566"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-846"></span><span>
</span><span id="line-847"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#wrapArg_P"><span class="hs-identifier hs-type">wrapArg_P</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#GenericKind"><span class="hs-identifier hs-type">GenericKind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-848"></span><span id="wrapArg_P"><span class="annot"><span class="annottext">wrapArg_P :: GenericKind -&gt; RdrName -&gt; Type -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#wrapArg_P"><span class="hs-identifier hs-var hs-var">wrapArg_P</span></a></span></span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen0"><span class="hs-identifier hs-var">Gen0</span></a></span><span> </span><span id="local-6989586621681170565"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681170565"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span id="local-6989586621681170564"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170564"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkM1_P"><span class="hs-identifier hs-var">mkM1_P</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LPat GhcPs
forall (name :: Pass). LPat (GhcPass name) -&gt; LPat (GhcPass name)
</span><a href="GHC.Hs.Utils.html#nlParPat"><span class="hs-identifier hs-var">nlParPat</span></a></span><span> </span><span class="annot"><span class="annottext">(LPat GhcPs -&gt; LPat GhcPs) -&gt; LPat GhcPs -&gt; LPat GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; RdrName
</span><a href="GHC.Tc.Deriv.Generics.html#boxRepRDR"><span class="hs-identifier hs-var">boxRepRDR</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681170564"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; [RdrName] -&gt; LPat GhcPs
</span><a href="GHC.Hs.Utils.html#nlConVarPat"><span class="hs-operator hs-var">`nlConVarPat`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681170565"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-849"></span><span>                   </span><span class="hs-comment">-- This M1 is meta-information for the selector</span><span>
</span><span id="line-850"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#wrapArg_P"><span class="hs-identifier hs-var">wrapArg_P</span></a></span><span> </span><span class="annot"><span class="annottext">GenericKind
</span><a href="GHC.Tc.Deriv.Generics.html#Gen1"><span class="hs-identifier hs-var">Gen1</span></a></span><span> </span><span id="local-6989586621681170563"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681170563"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LPat GhcPs
forall (name :: Pass). LPat (GhcPass name) -&gt; LPat (GhcPass name)
</span><a href="GHC.Hs.Utils.html#nlParPat"><span class="hs-identifier hs-var">nlParPat</span></a></span><span> </span><span class="annot"><span class="annottext">(LPat GhcPs -&gt; LPat GhcPs) -&gt; LPat GhcPs -&gt; LPat GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#m1DataCon_RDR"><span class="hs-identifier hs-var">m1DataCon_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; [RdrName] -&gt; LPat GhcPs
</span><a href="GHC.Hs.Utils.html#nlConVarPat"><span class="hs-operator hs-var">`nlConVarPat`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681170563"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-851"></span><span>
</span><span id="line-852"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mkGenericLocal"><span class="hs-identifier hs-type">mkGenericLocal</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#US"><span class="hs-identifier hs-type">US</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span>
</span><span id="line-853"></span><span id="mkGenericLocal"><span class="annot"><span class="annottext">mkGenericLocal :: US -&gt; RdrName
</span><a href="GHC.Tc.Deriv.Generics.html#mkGenericLocal"><span class="hs-identifier hs-var hs-var">mkGenericLocal</span></a></span></span><span> </span><span id="local-6989586621681170561"><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170561"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; RdrName
</span><a href="GHC.Types.Name.Reader.html#mkVarUnqual"><span class="hs-identifier hs-var">mkVarUnqual</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;g&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">US -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><a href="#local-6989586621681170561"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-854"></span><span>
</span><span id="line-855"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#x_RDR"><span class="hs-identifier hs-type">x_RDR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span>
</span><span id="line-856"></span><span id="x_RDR"><span class="annot"><span class="annottext">x_RDR :: RdrName
</span><a href="GHC.Tc.Deriv.Generics.html#x_RDR"><span class="hs-identifier hs-var hs-var">x_RDR</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; RdrName
</span><a href="GHC.Types.Name.Reader.html#mkVarUnqual"><span class="hs-identifier hs-var">mkVarUnqual</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#fsLit"><span class="hs-identifier hs-var">fsLit</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;x&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-857"></span><span>
</span><span id="line-858"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#x_Expr"><span class="hs-identifier hs-type">x_Expr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-859"></span><span id="x_Expr"><span class="annot"><span class="annottext">x_Expr :: LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_Expr"><span class="hs-identifier hs-var hs-var">x_Expr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_RDR"><span class="hs-identifier hs-var">x_RDR</span></a></span><span>
</span><span id="line-860"></span><span>
</span><span id="line-861"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#x_Pat"><span class="hs-identifier hs-type">x_Pat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-862"></span><span id="x_Pat"><span class="annot"><span class="annottext">x_Pat :: LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_Pat"><span class="hs-identifier hs-var hs-var">x_Pat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LPat GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LPat (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlVarPat"><span class="hs-identifier hs-var">nlVarPat</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#x_RDR"><span class="hs-identifier hs-var">x_RDR</span></a></span><span>
</span><span id="line-863"></span><span>
</span><span id="line-864"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mkM1_E"><span class="hs-identifier hs-type">mkM1_E</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-865"></span><span id="mkM1_E"><span class="annot"><span class="annottext">mkM1_E :: LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkM1_E"><span class="hs-identifier hs-var hs-var">mkM1_E</span></a></span></span><span> </span><span id="local-6989586621681170554"><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170554"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass). IdP (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsVar"><span class="hs-identifier hs-var">nlHsVar</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#m1DataCon_RDR"><span class="hs-identifier hs-var">m1DataCon_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
forall (id :: Pass).
IsPass id =&gt;
LHsExpr (GhcPass id)
-&gt; LHsExpr (GhcPass id) -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApp"><span class="hs-operator hs-var">`nlHsApp`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170554"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-866"></span><span>
</span><span id="line-867"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#mkM1_P"><span class="hs-identifier hs-type">mkM1_P</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-868"></span><span id="mkM1_P"><span class="annot"><span class="annottext">mkM1_P :: LPat GhcPs -&gt; LPat GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#mkM1_P"><span class="hs-identifier hs-var hs-var">mkM1_P</span></a></span></span><span> </span><span id="local-6989586621681170553"><span class="annot"><span class="annottext">LPat GhcPs
</span><a href="#local-6989586621681170553"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat GhcPs -&gt; LPat GhcPs
forall (name :: Pass). LPat (GhcPass name) -&gt; LPat (GhcPass name)
</span><a href="GHC.Hs.Utils.html#nlParPat"><span class="hs-identifier hs-var">nlParPat</span></a></span><span> </span><span class="annot"><span class="annottext">(LPat GhcPs -&gt; LPat GhcPs) -&gt; LPat GhcPs -&gt; LPat GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="GHC.Builtin.Names.html#m1DataCon_RDR"><span class="hs-identifier hs-var">m1DataCon_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; [LPat GhcPs] -&gt; LPat GhcPs
</span><a href="GHC.Hs.Utils.html#nlConPat"><span class="hs-operator hs-var">`nlConPat`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LPat GhcPs
</span><a href="#local-6989586621681170553"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-869"></span><span>
</span><span id="line-870"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#nlHsCompose"><span class="hs-identifier hs-type">nlHsCompose</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-871"></span><span id="nlHsCompose"><span class="annot"><span class="annottext">nlHsCompose :: LHsExpr GhcPs -&gt; LHsExpr GhcPs -&gt; LHsExpr GhcPs
</span><a href="GHC.Tc.Deriv.Generics.html#nlHsCompose"><span class="hs-identifier hs-var hs-var">nlHsCompose</span></a></span></span><span> </span><span id="local-6989586621681170552"><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170552"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681170551"><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170551"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RdrName
IdP GhcPs
</span><a href="GHC.Builtin.Names.html#compose_RDR"><span class="hs-identifier hs-var">compose_RDR</span></a></span><span> </span><span class="annot"><span class="annottext">IdP GhcPs -&gt; [LHsExpr GhcPs] -&gt; LHsExpr GhcPs
forall (id :: Pass).
IsPass id =&gt;
IdP (GhcPass id) -&gt; [LHsExpr (GhcPass id)] -&gt; LHsExpr (GhcPass id)
</span><a href="GHC.Hs.Utils.html#nlHsApps"><span class="hs-operator hs-var">`nlHsApps`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170552"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsExpr GhcPs
</span><a href="#local-6989586621681170551"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-872"></span><span>
</span><span id="line-873"></span><span class="hs-comment">-- | Variant of foldr for producing balanced lists</span><span>
</span><span id="line-874"></span><span id="local-6989586621681171346"><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#foldBal"><span class="hs-identifier hs-type">foldBal</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621681171346"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681171346"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681171346"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681171346"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681171346"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681171346"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-875"></span><span id="foldBal"><span class="annot"><span class="annottext">foldBal :: forall a. (a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#foldBal"><span class="hs-identifier hs-var hs-var">foldBal</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span>  </span><span id="local-6989586621681170546"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681170546"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681170546"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-876"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#foldBal"><span class="hs-identifier hs-var">foldBal</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span>  </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621681170545"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681170545"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681170545"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-877"></span><span class="annot"><a href="GHC.Tc.Deriv.Generics.html#foldBal"><span class="hs-identifier hs-var">foldBal</span></a></span><span> </span><span id="local-6989586621681170544"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621681170544"><span class="hs-identifier hs-var">op</span></a></span></span><span> </span><span id="local-6989586621681170543"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681170543"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681170542"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681170542"><span class="hs-identifier hs-var">l</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681170541"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681170541"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681170540"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681170540"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">US -&gt; [a] -&gt; ([a], [a])
forall a. US -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/GHC.List.html#splitAt"><span class="hs-identifier hs-var">splitAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; US
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; US
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681170542"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">US -&gt; US -&gt; US
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-operator hs-var">`div`</span></a></span><span> </span><span class="annot"><span class="annottext">US
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681170542"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-878"></span><span>                   </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
forall a. (a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#foldBal"><span class="hs-identifier hs-var">foldBal</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621681170544"><span class="hs-identifier hs-var">op</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681170543"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681170541"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621681170544"><span class="hs-operator hs-var">`op`</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
forall a. (a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
</span><a href="GHC.Tc.Deriv.Generics.html#foldBal"><span class="hs-identifier hs-var">foldBal</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621681170544"><span class="hs-identifier hs-var">op</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681170543"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681170540"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-879"></span><span>
</span><span id="line-880"></span><span class="hs-comment">{-
Note [Generics and unlifted types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Normally, all constants are marked with K1/Rec0. The exception to this rule is
when a data constructor has an unlifted argument (e.g., Int#, Char#, etc.). In
that case, we must use a data family instance of URec (from GHC.Generics) to
mark it. As a result, before we can generate K1 or unK1, we must first check
to see if the type is actually one of the unlifted types for which URec has a
data family instance; if so, we generate that instead.

See wiki:commentary/compiler/generic-deriving#handling-unlifted-types for more
details on why URec is implemented the way it is.

Note [Generating a correctly typed Rep instance]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tc_mkRepTy derives the RHS of the Rep(1) type family instance when deriving
Generic(1). That is, it derives the ellipsis in the following:

    instance Generic Foo where
      type Rep Foo = ...

However, tc_mkRepTy only has knowledge of the *TyCon* of the type for which
a Generic(1) instance is being derived, not the fully instantiated type. As a
result, tc_mkRepTy builds the most generalized Rep(1) instance possible using
the type variables it learns from the TyCon (i.e., it uses tyConTyVars). This
can cause problems when the instance has instantiated type variables
(see #11732). As an example:

    data T a = MkT a
    deriving instance Generic (T Int)
    ==&gt;
    instance Generic (T Int) where
      type Rep (T Int) = (... (Rec0 a)) -- wrong!

-XStandaloneDeriving is one way for the type variables to become instantiated.
Another way is when Generic1 is being derived for a datatype with a visible
kind binder, e.g.,

   data P k (a :: k) = MkP k deriving Generic1
   ==&gt;
   instance Generic1 (P *) where
     type Rep1 (P *) = (... (Rec0 k)) -- wrong!

See Note [Unify kinds in deriving] in GHC.Tc.Deriv.

In any such scenario, we must prevent a discrepancy between the LHS and RHS of
a Rep(1) instance. To do so, we create a type variable substitution that maps
the tyConTyVars of the TyCon to their counterparts in the fully instantiated
type. (For example, using T above as example, you'd map a :-&gt; Int.) We then
apply the substitution to the RHS before generating the instance.

A wrinkle in all of this: when forming the type variable substitution for
Generic1 instances, we map the last type variable of the tycon to Any. Why?
It's because of wily data types like this one (#15012):

   data T a = MkT (FakeOut a)
   type FakeOut a = Int

If we ignore a, then we'll produce the following Rep1 instance:

   instance Generic1 T where
     type Rep1 T = ... (Rec0 (FakeOut a))
     ...

Oh no! Now we have `a` on the RHS, but it's completely unbound. Instead, we
ensure that `a` is mapped to Any:

   instance Generic1 T where
     type Rep1 T = ... (Rec0 (FakeOut Any))
     ...

And now all is good.

Alternatively, we could have avoided this problem by expanding all type
synonyms on the RHSes of Rep1 instances. But we might blow up the size of
these types even further by doing this, so we choose not to do so.

Note [Handling kinds in a Rep instance]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Because Generic1 is poly-kinded, the representation types were generalized to
be kind-polymorphic as well. As a result, tc_mkRepTy must explicitly apply
the kind of the instance being derived to all the representation type
constructors. For instance, if you have

    data Empty (a :: k) = Empty deriving Generic1

Then the generated code is now approximately (with -fprint-explicit-kinds
syntax):

    instance Generic1 k (Empty k) where
      type Rep1 k (Empty k) = U1 k

Most representation types have only one kind variable, making them easy to deal
with. The only non-trivial case is (:.:), which is only used in Generic1
instances:

    newtype (:.:) (f :: k2 -&gt; *) (g :: k1 -&gt; k2) (p :: k1) =
        Comp1 { unComp1 :: f (g p) }

Here, we do something a bit counter-intuitive: we make k1 be the kind of the
instance being derived, and we always make k2 be *. Why *? It's because
the code that GHC generates using (:.:) is always of the form x :.: Rec1 y
for some types x and y. In other words, the second type to which (:.:) is
applied always has kind k -&gt; *, for some kind k, so k2 cannot possibly be
anything other than * in a generated Generic1 instance.

Note [Generics compilation speed tricks]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Deriving Generic(1) is known to have a large constant factor during
compilation, which contributes to noticeable compilation slowdowns when
deriving Generic(1) for large datatypes (see #5642).

To ease the pain, there is a trick one can play when generating definitions for
to(1) and from(1). If you have a datatype like:

  data Letter = A | B | C | D

then a na&#239;ve Generic instance for Letter would be:

  instance Generic Letter where
    type Rep Letter = D1 ('MetaData ...) ...

    to (M1 (L1 (L1 (M1 U1)))) = A
    to (M1 (L1 (R1 (M1 U1)))) = B
    to (M1 (R1 (L1 (M1 U1)))) = C
    to (M1 (R1 (R1 (M1 U1)))) = D

    from A = M1 (L1 (L1 (M1 U1)))
    from B = M1 (L1 (R1 (M1 U1)))
    from C = M1 (R1 (L1 (M1 U1)))
    from D = M1 (R1 (R1 (M1 U1)))

Notice that in every LHS pattern-match of the 'to' definition, and in every RHS
expression in the 'from' definition, the topmost constructor is M1. This
corresponds to the datatype-specific metadata (the D1 in the Rep Letter
instance). But this is wasteful from a typechecking perspective, since this
definition requires GHC to typecheck an application of M1 in every single case,
leading to an O(n) increase in the number of coercions the typechecker has to
solve, which in turn increases allocations and degrades compilation speed.

Luckily, since the topmost M1 has the exact same type across every case, we can
factor it out reduce the typechecker's burden:

  instance Generic Letter where
    type Rep Letter = D1 ('MetaData ...) ...

    to (M1 x) = case x of
      L1 (L1 (M1 U1)) -&gt; A
      L1 (R1 (M1 U1)) -&gt; B
      R1 (L1 (M1 U1)) -&gt; C
      R1 (R1 (M1 U1)) -&gt; D

    from x = M1 (case x of
      A -&gt; L1 (L1 (M1 U1))
      B -&gt; L1 (R1 (M1 U1))
      C -&gt; R1 (L1 (M1 U1))
      D -&gt; R1 (R1 (M1 U1)))

A simple change, but one that pays off, since it goes turns an O(n) amount of
coercions to an O(1) amount.
-}</span><span>
</span><span id="line-1041"></span></pre></body></html>